
/* ****************************************************************** */
/*  Authors:      Beth Reingold, Rebecca Kreitzer, Tracy Osborn,      */
/*                   & Michele Swers                                  */
/*  Date:         March 4, 2020			  			  	              */
/*  Purpose:      Replication of all Tables & Figures:                */
/*             "Anti-Abortion Policymaking & Women's Representation"  */
/*                Political Research Quarterly                        */
/*                (article and appendix/supplemental materials)       */
/*  Input Files:  anti_abort replication main 28Jan20.dta             */
/*                anti_abort replication leg_party 27Jan20.dta        */
/*                anti_abort replication leg_party_compet 28Jan20.dta */
/*  Final File:   same as input files (no save)                       */
/*	Notes: 		 SPost commands needed; see Long and Freese (2014)    */
/*					for downloading instructions					  */
/* ****************************************************************** */



*Install 'grc1leg' ado-file to combine graphs onto one with a common legend
net search grc1leg
*Click on the link for 'grc1leg from http://www.stata.com/users/vwiggins'
*Follow instructions/link for installation



****MODEL 1: Legislator-Session w/ State FE and SE Cluster(sler_candid2)****
use "anti_abort replication main 28Jan20.dta", clear


//////////////////
** Table 1: Sponsorship of Abortion Legislation in State Houses, 1997-2012 **
* Effect of Party Control and Competition across All Statehouses
//////////////////

logit bin_pro_all i.IPG8 bills_intro rep_control competitive i.fips, cluster (sler_candid2)
mtable, at(IPG8=(1 2 3 4 5 6 7 8)) statistics (ci se)
mgen, at(IPG8=(1 2 3 4 5 6 7 8)) stub(t12amodel1) 
graph twoway scatter t12amodel1pr t12amodel1IPG8 || rcap t12amodel1ll t12amodel1ul t12amodel1IPG8, lcolor(gs10) ///
	xlabel(1 "ConsRWoman" 2 "ConsRMan" 3 "Mod-LibRWoman" 4 "Mod-LibRMan" 5 "Mod-ConsDMan" 6 "Mod-ConsDWoman" 7 "LibDMan" 8 "LibDWoman") ///
	xlabel(, angle(45)labsize(small)) graphregion(color(white)) ytitle("Pr(Sponsored ≥1  Bill)")  ///
	xtitle("Legislator Ideology/Party/Gender") title("Pro Abortion Rights Bills", size(msmall)) legend(rows(1) order(1 "Estimate" 2 "95% CI") size(vsmall)) ///
	saving("t12amodel1.gph", replace)
mchange IPG8

logit bin_anti_all i.IPG8 bills_intro rep_control competitive i.fips, cluster (sler_candid2)
mtable, at(IPG8=(1 2 3 4 5 6 7 8)) statistics (ci se)
mgen, at(IPG8=(1 2 3 4 5 6 7 8)) stub(t12bmodel1) 
graph twoway scatter t12bmodel1pr t12bmodel1IPG8 || rcap t12bmodel1ll t12bmodel1ul t12bmodel1IPG8, lcolor(gs10) ///
	xlabel(1 "ConsRWoman" 2 "ConsRMan" 3 "Mod-LibRWoman" 4 "Mod-LibRMan" 5 "Mod-ConsDMan" 6 "Mod-ConsDWoman" 7 "LibDMan" 8 "LibDWoman") ///
	xlabel(, angle(45)labsize(small)) graphregion(color(white)) ytitle("Pr(Sponsored ≥1  Bill)")  ///
	xtitle("Legislator Ideology/Party/Gender") title("Anti Abortion Bills", size(msmall)) legend(rows(1) order(1 "Estimate" 2 "95% CI") size(vsmall)) ///
	saving("t12bmodel1.gph", replace)
mchange IPG8


**Figure 2: Sponsorship of Any Abortion Rights or Anti-Abortion Legislation **
grc1leg "t12amodel1.gph" "t12bmodel1.gph", ///
	graphregion(color(white)) legendfrom("t12bmodel1.gph") ring(6) iscale(.60) ///
	saving("Figure_2.gph", replace)


	
logit bin_anti_womtot i.IPG8 bills_intro rep_control competitive i.fips, cluster (sler_candid2)
mtable, at(IPG8=(1 2 3 4 5 6 7 8)) statistics (ci se)
mgen, at(IPG8=(1 2 3 4 5 6 7 8)) stub(t12cmodel1) 
graph twoway scatter t12cmodel1pr t12cmodel1IPG8 || rcap t12cmodel1ll t12cmodel1ul t12cmodel1IPG8, lcolor(gs10) ///
	xlabel(1 "ConsRWoman" 2 "ConsRMan" 3 "Mod-LibRWoman" 4 "Mod-LibRMan" 5 "Mod-ConsDMan" 6 "Mod-ConsDWoman" 7 "LibDMan" 8 "LibDWoman") ///
	xlabel(, angle(45)labsize(small)) graphregion(color(white)) ytitle("Pr(Sponsored ≥1 Bill)")  ///
	xtitle("Legislator Ideology/Party/Gender") title("Anti Abortion: Pro-Woman Bills", size(small)) legend(rows(1) order(1 "Estimate" 2 "95% CI") size(vsmall)) ///
	saving("t12cmodel1.gph", replace)
mchange IPG8

logit bin_anti_fetus i.IPG8 bills_intro rep_control competitive i.fips, cluster (sler_candid2)
mtable, at(IPG8=(1 2 3 4 5 6 7 8)) statistics (ci se)
mgen, at(IPG8=(1 2 3 4 5 6 7 8)) stub(t12dmodel1) 
graph twoway scatter t12dmodel1pr t12dmodel1IPG8 || rcap t12dmodel1ll t12dmodel1ul t12dmodel1IPG8, lcolor(gs10) ///
	xlabel(1 "ConsRWoman" 2 "ConsRMan" 3 "Mod-LibRWoman" 4 "Mod-LibRMan" 5 "Mod-ConsDMan" 6 "Mod-ConsDWoman" 7 "LibDMan" 8 "LibDWoman") ///
	xlabel(, angle(45)labsize(small)) graphregion(color(white)) ytitle("Pr(Sponsored ≥1 Bill)")  ///
	xtitle("Legislator Ideology/Party/Gender") title("Anti Abortion: Fetal Centric Bills", size(small)) legend(rows(1) order(1 "Estimate" 2 "95% CI") size(vsmall)) ///
	saving("t12dmodel1.gph", replace)
mchange IPG8

logit bin_anti_relig i.IPG8 bills_intro rep_control competitive i.fips, cluster (sler_candid2)
mtable, at(IPG8=(1 2 3 4 5 6 7 8)) statistics (ci se)
mgen, at(IPG8=(1 2 3 4 5 6 7 8)) stub(t12emodel1) 
graph twoway scatter t12emodel1pr t12emodel1IPG8 || rcap t12emodel1ll t12emodel1ul t12emodel1IPG8, lcolor(gs10) ///
	xlabel(1 "ConsRWoman" 2 "ConsRMan" 3 "Mod-LibRWoman" 4 "Mod-LibRMan" 5 "Mod-ConsDMan" 6 "Mod-ConsDWoman" 7 "LibDMan" 8 "LibDWoman") ///
	xlabel(, angle(45)labsize(small)) graphregion(color(white)) ytitle("Pr(Sponsored ≥1 Bill)")  ///
	xtitle("Legislator Ideology/Party/Gender") title("Anti Abortion: Moral/Religious Bills", size(small)) legend(rows(1) order(1 "Estimate" 2 "95% CI") size(vsmall)) ///
	saving("t12emodel1.gph", replace)
mchange IPG8


**Figure 3: Sponsorship of Anti-Abortion Legislation by Issue Frame**
grc1leg "t12cmodel1.gph" "t12dmodel1.gph" "t12emodel1.gph", col(3) ///
	graphregion(color(white)) legendfrom("t12cmodel1.gph") ring(6) iscale(.60) ///
	saving("Figure_3.gph", replace)



//////////////////
** Table 2: Sponsorship of Abortion Legislation in Competitive and Non-Competitive State Houses, 1997-2012 **
* Conditioning Effect of Party Competition, controlling for GOP control
//////////////////

*Recode IPG8 so that conditional results (competitive vs. non-competitive) can be on the same graph
*(by off-setting the competitive predictions slightly)
generate IPG80=.
replace IPG80=10 if IPG8==1
replace IPG80=20 if IPG8==2
replace IPG80=30 if IPG8==3
replace IPG80=40 if IPG8==4
replace IPG80=50 if IPG8==5
replace IPG80=60 if IPG8==6
replace IPG80=70 if IPG8==7
replace IPG80=80 if IPG8==8

generate IPG81=.
replace IPG81=11 if IPG8==1
replace IPG81=21 if IPG8==2
replace IPG81=31 if IPG8==3
replace IPG81=41 if IPG8==4
replace IPG81=51 if IPG8==5
replace IPG81=61 if IPG8==6
replace IPG81=71 if IPG8==7
replace IPG81=81 if IPG8==8

	

logit bin_pro_all IPG8##competitive bills_intro rep_control i.fips, cluster (sler_candid2)
estimates store base
mtable if competitive==0, at(IPG8=(1 2 3 4 5 6 7 8)) statistics (ci se)
mtable if competitive==1, at(IPG8=(1 2 3 4 5 6 7 8)) statistics (ci se)
mchange IPG8 if competitive==0
mchange IPG8 if competitive==1
**NOTE: These two mchange commands may not work with Stata14 (or earlier versions). 
* They do work with Stata15, but the labels are off because of empty cells in 
* one or more IPG8-competitive combinations. 

*To gauge and compare the effect of party competition across IPG8 subgroups (e.g., CRW vs. CRM):
**See Long and Freese (2014), p.285-86
mtable, dydx(competitive) over(IPG8) stat(ci pvalue) post
*mlincom 1-2
*mlincom 2-3
mlincom 3-4
mlincom 5-6
estimates restore base

quietly logit bin_pro_all IPG80##competitive bills_intro rep_control i.fips, cluster (sler_candid2)
mgen if competitive==0, at(IPG80=(10 20 30 40 50 60 70 80)) stub(t13amodel1) 
quietly logit bin_pro_all IPG81##competitive bills_intro rep_control i.fips, cluster (sler_candid2)
mgen if competitive==1, at(IPG81=(11 21 31 41 51 61 71 81)) stub(t13Camodel1) 
graph twoway scatter t13amodel1pr t13amodel1IPG80, msymbol(Oh) mcolor(navy) || rcap t13amodel1ll t13amodel1ul t13amodel1IPG80, lcolor(gs10) ///
    || scatter t13Camodel1pr t13Camodel1IPG81, mcolor(navy)|| rcap t13Camodel1ll t13Camodel1ul t13Camodel1IPG81, lcolor(gs10) ///
	xlabel(10 "ConsRWoman" 20 "ConsRMan" 30 "Mod-LibRWoman" 40 "Mod-LibRMan" 50 "Mod-ConsDMan" 60 "Mod-ConsDWoman" 70 "LibDMan" 80 "LibDWoman") ///
	xlabel(, angle(45)labsize(small)) graphregion(color(white)) ytitle("Pr(Sponsored ≥1  Bill)")  ///
	xtitle("Legislator Ideology/Party/Gender") title("Pro Abortion Rights Bills", size(small)) ///
	legend(rows(2) order(1 "Estimate, Non-Competitive State-Sessions" 2 "95% CI" 3 "Estimate, Competitive State-Sessions" 4 "95% CI") size(vsmall)) ///
	saving("t13amodel1.gph", replace)


logit bin_anti_all IPG8##competitive bills_intro rep_control i.fips, cluster (sler_candid2)
estimates store base
mtable if competitive==0, at(IPG8=(1 2 3 4 5 6 7 8)) statistics (ci se)
mtable if competitive==1, at(IPG8=(1 2 3 4 5 6 7 8)) statistics (ci se)
mchange IPG8 if competitive==0
mchange IPG8 if competitive==1

*To gauge and compare the effect of party competition across IPG8 subgroups (e.g., CRW vs. CRM):
**See Long and Freese (2014), p.285-86
mtable, dydx(competitive) over(IPG8) stat(ci pvalue) post
mlincom 1-2
mlincom 3-4
mlincom 5-6
mlincom 7-8
estimates restore base

quietly logit bin_anti_all IPG80##competitive bills_intro rep_control i.fips, cluster (sler_candid2)
mgen if competitive==0, at(IPG80=(10 20 30 40 50 60 70 80)) stub(t13bmodel1) 
quietly logit bin_anti_all IPG81##competitive bills_intro rep_control i.fips, cluster (sler_candid2)
mgen if competitive==1, at(IPG81=(11 21 31 41 51 61 71 81)) stub(t13Cbmodel1) 
graph twoway scatter t13bmodel1pr t13bmodel1IPG80, msymbol(Oh) mcolor(navy) || rcap t13bmodel1ll t13bmodel1ul t13bmodel1IPG80, lcolor(gs10) ///
    || scatter t13Cbmodel1pr t13Cbmodel1IPG81, mcolor(navy) || rcap t13Cbmodel1ll t13Cbmodel1ul t13Cbmodel1IPG81, lcolor(gs10) ///
	xlabel(10 "ConsRWoman" 20 "ConsRMan" 30 "Mod-LibRWoman" 40 "Mod-LibRMan" 50 "Mod-ConsDMan" 60 "Mod-ConsDWoman" 70 "LibDMan" 80 "LibDWoman") ///
	xlabel(, angle(45)labsize(small)) graphregion(color(white)) ytitle("Pr(Sponsored ≥1  Bill)")  ///
	xtitle("Legislator Ideology/Party/Gender") title("Anti Abortion Bills", size(small)) ///
	legend(rows(2) order(1 "Estimate, Non-Competitive State-Sessions" 2 "95% CI" 3 "Estimate, Competitive State-Sessions" 4 "95% CI") size(vsmall)) ///
	saving("t13bmodel1.gph", replace)

	
**Figure 4: Sponsorship of Any Abortion Rights or Anti-Abortion Legislation by Party**
grc1leg "t13amodel1.gph" "t13bmodel1.gph", ///
	graphregion(color(white)) legendfrom("t13amodel1.gph") ring(6) iscale(.60) ///
	saving("Figure_4.gph", replace)

	

logit bin_anti_womtot IPG8##competitive bills_intro rep_control i.fips, cluster (sler_candid2)
estimates store base
mtable if competitive==0, at(IPG8=(1 2 3 4 5 6 7 8)) statistics (ci se)
mtable if competitive==1, at(IPG8=(1 2 3 4 5 6 7 8)) statistics (ci se)
mchange IPG8 if competitive==0
mchange IPG8 if competitive==1
**NOTE: The first mchange command (if competitive==0) may not work with Stata14 (or earlier versions). 
* It does work with Stata15, but the labels are off. 

*To gauge and compare the effect of party competition across IPG8 subgroups (e.g., CRW vs. CRM):
**See Long and Freese (2014), p.285-86
mtable, dydx(competitive) over(IPG8) stat(ci pvalue) post
mlincom 1-2
mlincom 3-4
mlincom 5-6
*mlincom 7-8
estimates restore base

quietly logit bin_anti_womtot IPG80##competitive bills_intro rep_control i.fips, cluster (sler_candid2)
mgen if competitive==0, at(IPG80=(10 20 30 40 50 60 70 80)) stub(t13cmodel1) 
quietly logit bin_anti_womtot IPG81##competitive bills_intro rep_control i.fips, cluster (sler_candid2)
mgen if competitive==1, at(IPG81=(11 21 31 41 51 61 71 81)) stub(t13Ccmodel1) 
graph twoway scatter t13cmodel1pr t13cmodel1IPG80, msymbol(Oh) mcolor(navy) || rcap t13cmodel1ll t13cmodel1ul t13cmodel1IPG80, lcolor(gs10) ///
    || scatter t13Ccmodel1pr t13Ccmodel1IPG81, mcolor(navy) || rcap t13Ccmodel1ll t13Ccmodel1ul t13Ccmodel1IPG81, lcolor(gs10) ///
	xlabel(10 "ConsRWoman" 20 "ConsRMan" 30 "Mod-LibRWoman" 40 "Mod-LibRMan" 50 "Mod-ConsDMan" 60 "Mod-ConsDWoman" 70 "LibDMan" 80 "LibDWoman") ///
	xlabel(, angle(45)labsize(small)) graphregion(color(white)) ytitle("Pr(Sponsored ≥1  Bill)")  ///
	xtitle("Legislator Ideology/Party/Gender") title("Anti Abortion: Pro-Life Pro-Woman Bills", size(small)) ///
	legend(rows(2) order(1 "Estimate, Non-Competitive State-Sessions" 2 "95% CI" 3 "Estimate, Competitive State-Sessions" 4 "95% CI") size(vsmall)) ///
	saving("t13cmodel1.gph", replace)

	
logit bin_anti_fetus IPG8##competitive bills_intro rep_control i.fips, cluster (sler_candid2)
estimates store base
mtable if competitive==0, at(IPG8=(1 2 3 4 5 6 7 8)) statistics (ci se)
mtable if competitive==1, at(IPG8=(1 2 3 4 5 6 7 8)) statistics (ci se)
mchange IPG8 if competitive==0
mchange IPG8 if competitive==1

*To gauge and compare the effect of party competition across IPG8 subgroups (e.g., CRW vs. CRM):
**See Long and Freese (2014), p.285-86
mtable, dydx(competitive) over(IPG8) stat(ci pvalue) post
mlincom 1-2
mlincom 3-4
mlincom 5-6
mlincom 7-8
estimates restore base
	
quietly logit bin_anti_fetus IPG80##competitive bills_intro rep_control i.fips, cluster (sler_candid2)
mgen if competitive==0, at(IPG80=(10 20 30 40 50 60 70 80)) stub(t13dmodel1) 
quietly logit bin_anti_fetus IPG81##competitive bills_intro rep_control i.fips, cluster (sler_candid2)
mgen if competitive==1, at(IPG81=(11 21 31 41 51 61 71 81)) stub(t13Cdmodel1) 
graph twoway scatter t13dmodel1pr t13dmodel1IPG80, msymbol(Oh) mcolor(navy) || rcap t13dmodel1ll t13dmodel1ul t13dmodel1IPG80, lcolor(gs10) ///
    || scatter t13Cdmodel1pr t13Cdmodel1IPG81, mcolor(navy) || rcap t13Cdmodel1ll t13Cdmodel1ul t13Cdmodel1IPG81, lcolor(gs10) ///
	xlabel(10 "ConsRWoman" 20 "ConsRMan" 30 "Mod-LibRWoman" 40 "Mod-LibRMan" 50 "Mod-ConsDMan" 60 "Mod-ConsDWoman" 70 "LibDMan" 80 "LibDWoman") ///
	xlabel(, angle(45)labsize(small)) graphregion(color(white)) ytitle("Pr(Sponsored ≥1  Bill)")  ///
	xtitle("Legislator Ideology/Party/Gender") title("Anti Abortion: Fetal Centric Bills", size(small)) ///
	legend(rows(2) order(1 "Estimate, Non-Competitive State-Sessions" 2 "95% CI" 3 "Estimate, Competitive State-Sessions" 4 "95% CI") size(vsmall)) ///
	saving("t13dmodel1.gph", replace)

	
logit bin_anti_relig IPG8##competitive bills_intro rep_control i.fips, cluster (sler_candid2)
estimates store base
mtable if competitive==0, at(IPG8=(1 2 3 4 5 6 7 8)) statistics (ci se)
mtable if competitive==1, at(IPG8=(1 2 3 4 5 6 7 8)) statistics (ci se)
mchange IPG8 if competitive==0
mchange IPG8 if competitive==1

*To gauge and compare the effect of party control across IPG8 subgroups (e.g., CRW vs. CRM):
**See Long and Freese (2014), p.285-86
mtable, dydx(competitive) over(IPG8) stat(ci pvalue) post
mlincom 1-2
mlincom 3-4
mlincom 5-6
mlincom 7-8
estimates restore base

quietly logit bin_anti_relig IPG80##competitive bills_intro rep_control i.fips, cluster (sler_candid2)
mgen if competitive==0, at(IPG80=(10 20 30 40 50 60 70 80)) stub(t13emodel1) 
quietly logit bin_anti_relig IPG81##competitive bills_intro  rep_control i.fips, cluster (sler_candid2)
mgen if competitive==1, at(IPG81=(11 21 31 41 51 61 71 81)) stub(t13Cemodel1) 
graph twoway scatter t13emodel1pr t13emodel1IPG80, msymbol(Oh) mcolor(navy) || rcap t13emodel1ll t13emodel1ul t13emodel1IPG80, lcolor(gs10) ///
    || scatter t13Cemodel1pr t13Cemodel1IPG81, mcolor(navy) || rcap t13Cemodel1ll t13Cemodel1ul t13Cemodel1IPG81, lcolor(gs10) ///
	xlabel(10 "ConsRWoman" 20 "ConsRMan" 30 "Mod-LibRWoman" 40 "Mod-LibRMan" 50 "Mod-ConsDMan" 60 "Mod-ConsDWoman" 70 "LibDMan" 80 "LibDWoman") ///
	xlabel(, angle(45)labsize(small)) graphregion(color(white)) ytitle("Pr(Sponsored ≥1  Bill)")  ///
	xtitle("Legislator Ideology/Party/Gender") title("Anti Abortion: Religious Bills", size(small)) ///
	legend(rows(2) order(1 "Estimate, Non-Competitive State-Sessions" 2 "95% CI" 3 "Estimate, Competitive State-Sessions" 4 "95% CI") size(vsmall)) ///
	saving("t13emodel1.gph", replace)

	
**Figure 5: Sponsorship of Anti-Abortion Legislation by Issue Frame and Party Competition**
grc1leg "t13cmodel1.gph" "t13dmodel1.gph" "t13emodel1.gph", col(3) ///
	graphregion(color(white)) legendfrom("t13cmodel1.gph") ring(6) iscale(.60) ///
	saving("Figure_5.gph", replace)
	

	
	
/////////////////////////
/* Appendix */
/////////////////////////


**Descriptive Statistics
* Table A3.1: Legislator-Session Unit of Analysis

*Dependent Variables*
tabstat bin_pro_all bin_anti_all bin_anti_womtot bin_anti_fetus bin_anti_relig if IPG8!=. & bills_intro!=., ///
   statistics( mean sd min max count) columns(statistics) longstub
   
*Independent Variables*
tabstat cons_rep_woman cons_rep_man modlib_R_woman modlib_R_man if IPG8!=. & bills_intro!=., ///
   statistics( mean sd min max count) columns(statistics) longstub
   
tabstat modcons_D_man modcons_D_woman lib_dem_man lib_dem_woman if IPG8!=. & bills_intro!=., ///
   statistics( mean sd min max count) columns(statistics) longstub

*Control Variables and Fixed Effects
tabstat bills_intro rep_control competitive if IPG8!=. & bills_intro!=., ///
   statistics( mean sd min max count) columns(statistics) longstub
   
tabstat AR AZ CA CO FL IL LA MD MS ND if IPG8!=. & bills_intro!=., ///
   statistics( mean sd min max count) columns(statistics) longstub
   
tabstat NJ NM NV OH PA SC TN TX UT WA WI if IPG8!=. & bills_intro!=., ///
   statistics( mean sd min max count) columns(statistics) longstub

   
*Clear all post-estimation variables in preparation for...
clear


***Sensitivity Analysis: Excluding Post-2010 Observations***
use "anti_abort replication main 28Jan20.dta"

drop if sess_yr1 > 2010 | reg_session=="2010-11" /* This excludes the 2010-11 NJ session */


**Descriptive Statistics
* Table A3.2: Legislator-Session Unit of Analysis, 1997-2010 Only

*Dependent Variables*
tabstat bin_pro_all bin_anti_all bin_anti_womtot bin_anti_fetus bin_anti_relig if IPG8!=. & bills_intro!=., ///
   statistics( mean sd min max count) columns(statistics) longstub
   
*Independent Variables*
tabstat cons_rep_woman cons_rep_man modlib_R_woman modlib_R_man if IPG8!=. & bills_intro!=., ///
   statistics( mean sd min max count) columns(statistics) longstub
   
tabstat modcons_D_man modcons_D_woman lib_dem_man lib_dem_woman if IPG8!=. & bills_intro!=., ///
   statistics( mean sd min max count) columns(statistics) longstub

*Control Variables and Fixed Effects
tabstat bills_intro rep_control competitive if IPG8!=. & bills_intro!=., ///
   statistics( mean sd min max count) columns(statistics) longstub
   
tabstat AR AZ CA CO FL IL LA MD MS ND if IPG8!=. & bills_intro!=., ///
   statistics( mean sd min max count) columns(statistics) longstub
   
tabstat NJ NM NV OH PA SC TN TX UT WA WI if IPG8!=. & bills_intro!=., ///
   statistics( mean sd min max count) columns(statistics) longstub


logit bin_pro_all i.IPG8 bills_intro rep_control competitive i.fips, cluster (sler_candid2)
mtable, at(IPG8=(1 2 3 4 5 6 7 8)) statistics (ci se)
mgen, at(IPG8=(1 2 3 4 5 6 7 8)) stub(tS12amodel1) 
graph twoway scatter tS12amodel1pr tS12amodel1IPG8 || rcap tS12amodel1ll tS12amodel1ul tS12amodel1IPG8, lcolor(gs10) ///
	xlabel(1 "ConsRWoman" 2 "ConsRMan" 3 "Mod-LibRWoman" 4 "Mod-LibRMan" 5 "Mod-ConsDMan" 6 "Mod-ConsDWoman" 7 "LibDMan" 8 "LibDWoman") ///
	xlabel(, angle(45)labsize(small)) graphregion(color(white)) ytitle("Pr(Sponsored ≥1 Bill)")  ///
	xtitle("Legislator Ideology/Party/Gender") title("Pro Abortion Rights Bills", size(msmall)) legend(rows(1) order(1 "Estimate" 2 "95% CI") size(vsmall)) ///
	saving("tS12amodel1.gph", replace)
mchange IPG8


logit bin_anti_all i.IPG8 bills_intro rep_control competitive i.fips, cluster (sler_candid2)
mtable, at(IPG8=(1 2 3 4 5 6 7 8)) statistics (ci se)
mgen, at(IPG8=(1 2 3 4 5 6 7 8)) stub(tS12bmodel1) 
graph twoway scatter tS12bmodel1pr tS12bmodel1IPG8 || rcap tS12bmodel1ll tS12bmodel1ul tS12bmodel1IPG8, lcolor(gs10) ///
	xlabel(1 "ConsRWoman" 2 "ConsRMan" 3 "Mod-LibRWoman" 4 "Mod-LibRMan" 5 "Mod-ConsDMan" 6 "Mod-ConsDWoman" 7 "LibDMan" 8 "LibDWoman") ///
	xlabel(, angle(45)labsize(small)) graphregion(color(white)) ytitle("Pr(Sponsored ≥1 Bill)")  ///
	xtitle("Legislator Ideology/Party/Gender") title("Anti Abortion Bills", size(msmall)) legend(rows(1) order(1 "Estimate" 2 "95% CI") size(vsmall)) ///
	saving("tS12bmodel1.gph", replace)
mchange IPG8


**Figure A4.2: Sponsorship of Any Abortion Rights or Anti-Abortion Legislation, 1997-2010 Only**
grc1leg "tS12amodel1.gph" "tS12bmodel1.gph", ///
	graphregion(color(white)) legendfrom("tS12bmodel1.gph") ring(6) iscale(.60) ///
	saving("Figure_A4.2.gph", replace)

	
	
logit bin_anti_womtot i.IPG8 bills_intro rep_control competitive i.fips, cluster (sler_candid2)
mtable, at(IPG8=(1 2 3 4 5 6 7 8)) statistics (ci se)
mgen, at(IPG8=(1 2 3 4 5 6 7 8)) stub(tS12cmodel1) 
graph twoway scatter tS12cmodel1pr tS12cmodel1IPG8 || rcap tS12cmodel1ll tS12cmodel1ul tS12cmodel1IPG8, lcolor(gs10) ///
	xlabel(1 "ConsRWoman" 2 "ConsRMan" 3 "Mod-LibRWoman" 4 "Mod-LibRMan" 5 "Mod-ConsDMan" 6 "Mod-ConsDWoman" 7 "LibDMan" 8 "LibDWoman") ///
	xlabel(, angle(45)labsize(small)) graphregion(color(white)) ytitle("Pr(Sponsored ≥1 Bill)")  ///
	xtitle("Legislator Ideology/Party/Gender") title("Anti Abortion: Pro-Life Pro-Woman Bills", size(small)) legend(rows(1) order(1 "Estimate" 2 "95% CI") size(vsmall)) ///
	saving("tS12cmodel1.gph", replace)
mchange IPG8


logit bin_anti_fetus i.IPG8 bills_intro rep_control competitive i.fips, cluster (sler_candid2)
mtable, at(IPG8=(1 2 3 4 5 6 7 8)) statistics (ci se)
mgen, at(IPG8=(1 2 3 4 5 6 7 8)) stub(tS12dmodel1) 
graph twoway scatter tS12dmodel1pr tS12dmodel1IPG8 || rcap tS12dmodel1ll tS12dmodel1ul tS12dmodel1IPG8, lcolor(gs10) ///
	xlabel(1 "ConsRWoman" 2 "ConsRMan" 3 "Mod-LibRWoman" 4 "Mod-LibRMan" 5 "Mod-ConsDMan" 6 "Mod-ConsDWoman" 7 "LibDMan" 8 "LibDWoman") ///
	xlabel(, angle(45)labsize(small)) graphregion(color(white)) ytitle("Pr(Sponsored ≥1 Bill)")  ///
	xtitle("Legislator Ideology/Party/Gender") title("Anti Abortion: Fetal Centric Bills", size(small)) legend(rows(1) order(1 "Estimate" 2 "95% CI") size(vsmall)) ///
	saving("tS12dmodel1.gph", replace)
mchange IPG8


logit bin_anti_relig i.IPG8 bills_intro rep_control competitive i.fips, cluster (sler_candid2)
mtable, at(IPG8=(1 2 3 4 5 6 7 8)) statistics (ci se)
mgen, at(IPG8=(1 2 3 4 5 6 7 8)) stub(tS12emodel1) 
graph twoway scatter tS12emodel1pr tS12emodel1IPG8 || rcap tS12emodel1ll tS12emodel1ul tS12emodel1IPG8, lcolor(gs10) ///
	xlabel(1 "ConsRWoman" 2 "ConsRMan" 3 "Mod-LibRWoman" 4 "Mod-LibRMan" 5 "Mod-ConsDMan" 6 "Mod-ConsDWoman" 7 "LibDMan" 8 "LibDWoman") ///
	xlabel(, angle(45)labsize(small)) graphregion(color(white)) ytitle("Pr(Sponsored ≥1 Bill)")  ///
	xtitle("Legislator Ideology/Party/Gender") title("Anti Abortion: Religious Bills", size(small)) legend(rows(1) order(1 "Estimate" 2 "95% CI") size(vsmall)) ///
	saving("tS12emodel1.gph", replace)
mchange IPG8


**Figure A4.3: Sponsorship of Anti-Abortion Legislation by Issue Frame, 1997-2010 Only**
grc1leg "tS12cmodel1.gph" "tS12dmodel1.gph" "tS12emodel1.gph", col(3) ///
	graphregion(color(white)) legendfrom("tS12cmodel1.gph") ring(6) iscale(.60) ///
	saving("Figure_A4_3.gph", replace)	

	
	
*Recode IPG8 so that conditional results (competitive vs. non-competitive) can be on the same graph
*(by off-setting the competitive predictions slightly)
generate IPG80=.
replace IPG80=10 if IPG8==1
replace IPG80=20 if IPG8==2
replace IPG80=30 if IPG8==3
replace IPG80=40 if IPG8==4
replace IPG80=50 if IPG8==5
replace IPG80=60 if IPG8==6
replace IPG80=70 if IPG8==7
replace IPG80=80 if IPG8==8

generate IPG81=.
replace IPG81=11 if IPG8==1
replace IPG81=21 if IPG8==2
replace IPG81=31 if IPG8==3
replace IPG81=41 if IPG8==4
replace IPG81=51 if IPG8==5
replace IPG81=61 if IPG8==6
replace IPG81=71 if IPG8==7
replace IPG81=81 if IPG8==8


logit bin_pro_all IPG8##competitive bills_intro rep_control i.fips, cluster (sler_candid2)
estimates store base
mtable if competitive==0, at(IPG8=(1 2 3 4 5 6 7 8)) statistics (ci se)
mtable if competitive==1, at(IPG8=(1 2 3 4 5 6 7 8)) statistics (ci se)
mchange IPG8 if competitive==0
mchange IPG8 if competitive==1
**NOTE: These two mchange commands may not work with Stata14 (or earlier versions). 
* They do work with Stata15, but the labels are off because of empty cells in 
* one or more IPG8-competitive combinations. 

*To gauge and compare the effect of party competition across IPG8 subgroups (e.g., CRW vs. CRM):
**See Long and Freese (2014), p.285-86
mtable, dydx(competitive) over(IPG8) stat(ci pvalue) post
*mlincom 1-2
*mlincom 2-3
mlincom 3-4
mlincom 5-6
estimates restore base

quietly logit bin_pro_all IPG80##competitive bills_intro rep_control i.fips, cluster (sler_candid2)
mgen if competitive==0, at(IPG80=(10 20 30 40 50 60 70 80)) stub(tS13amodel1) 
quietly logit bin_pro_all IPG81##competitive bills_intro rep_control i.fips, cluster (sler_candid2)
mgen if competitive==1, at(IPG81=(11 21 31 41 51 61 71 81)) stub(tS13Camodel1) 
graph twoway scatter tS13amodel1pr tS13amodel1IPG80, msymbol(Oh) mcolor(navy) || rcap tS13amodel1ll tS13amodel1ul tS13amodel1IPG80, lcolor(gs10) ///
    || scatter tS13Camodel1pr tS13Camodel1IPG81, mcolor(navy) || rcap tS13Camodel1ll tS13Camodel1ul tS13Camodel1IPG81, lcolor(gs10) ///
	xlabel(10 "ConsRWoman" 20 "ConsRMan" 30 "Mod-LibRWoman" 40 "Mod-LibRMan" 50 "Mod-ConsDMan" 60 "Mod-ConsDWoman" 70 "LibDMan" 80 "LibDWoman") ///
	xlabel(, angle(45)labsize(small)) graphregion(color(white)) ytitle("Pr(Sponsored ≥1 Bill)")  ///
	xtitle("Legislator Ideology/Party/Gender") title("Pro Abortion Rights Bills", size(msmall)) ///
	legend(rows(2) order(1 "Estimate, Non-Competitive State-Sessions" 2 "95% CI" 3 "Estimate, Competitive State-Sessions" 4 "95% CI") size(vsmall)) ///
	saving("tS13amodel1.gph", replace)

	
	
logit bin_anti_all IPG8##competitive bills_intro rep_control i.fips, cluster (sler_candid2)
estimates store base
mtable if competitive==0, at(IPG8=(1 2 3 4 5 6 7 8)) statistics (ci se)
mtable if competitive==1, at(IPG8=(1 2 3 4 5 6 7 8)) statistics (ci se)
mchange IPG8 if competitive==0
mchange IPG8 if competitive==1

*To gauge and compare the effect of party competition across IPG8 subgroups (e.g., CRW vs. CRM):
**See Long and Freese (2014), p.285-86
mtable, dydx(competitive) over(IPG8) stat(ci pvalue) post
mlincom 1-2
mlincom 3-4
mlincom 5-6
mlincom 7-8
estimates restore base

quietly logit bin_anti_all IPG80##competitive bills_intro rep_control i.fips, cluster (sler_candid2)
mgen if competitive==0, at(IPG80=(10 20 30 40 50 60 70 80)) stub(tS13bmodel1) 
quietly logit bin_anti_all IPG81##competitive bills_intro rep_control i.fips, cluster (sler_candid2)
mgen if competitive==1, at(IPG81=(11 21 31 41 51 61 71 81)) stub(tS13Cbmodel1) 
graph twoway scatter tS13bmodel1pr tS13bmodel1IPG80, msymbol(Oh) mcolor(navy) || rcap tS13bmodel1ll tS13bmodel1ul tS13bmodel1IPG80, lcolor(gs10) ///
    || scatter tS13Cbmodel1pr tS13Cbmodel1IPG81, mcolor(navy) || rcap tS13Cbmodel1ll tS13Cbmodel1ul tS13Cbmodel1IPG81, lcolor(gs10) ///
	xlabel(10 "ConsRWoman" 20 "ConsRMan" 30 "Mod-LibRWoman" 40 "Mod-LibRMan" 50 "Mod-ConsDMan" 60 "Mod-ConsDWoman" 70 "LibDMan" 80 "LibDWoman") ///
	xlabel(, angle(45)labsize(small)) graphregion(color(white)) ytitle("Pr(Sponsored ≥1 Bill)")  ///
	xtitle("Legislator Ideology/Party/Gender") title("Anti Abortion Bills", size(msmall)) ///
	legend(rows(2) order(1 "Estimate, Non-Competitive State-Sessions" 2 "95% CI" 3 "Estimate, Competitive State-Sessions" 4 "95% CI") size(vsmall)) ///
	saving("tS13bmodel1.gph", replace)

	
**Figure A4.4: Sponsorship of Any Abortion Rights or Anti-Abortion Legislation by Party Competition, 1997-2010 Only**
grc1leg "tS13amodel1.gph" "tS13bmodel1.gph", ///
	graphregion(color(white)) legendfrom("tS13amodel1.gph") ring(6) iscale(.60) ///
	saving("Figure_A4_4.gph", replace)

	

logit bin_anti_womtot IPG8##competitive bills_intro rep_control i.fips, cluster (sler_candid2)
estimates store base
mtable if competitive==0, at(IPG8=(1 2 3 4 5 6 7 8)) statistics (ci se)
mtable if competitive==1, at(IPG8=(1 2 3 4 5 6 7 8)) statistics (ci se)
mchange IPG8 if competitive==0
mchange IPG8 if competitive==1
**NOTE: The first mchange command (if competitive==0) may not work with Stata14 (or earlier versions). 
* It does work with Stata15, but the labels are off. 

*To gauge and compare the effect of party competition across IPG8 subgroups (e.g., CRW vs. CRM):
**See Long and Freese (2014), p.285-86
mtable, dydx(competitive) over(IPG8) stat(ci pvalue) post
mlincom 1-2
mlincom 3-4
mlincom 5-6
*mlincom 7-8
estimates restore base

quietly logit bin_anti_womtot IPG80##competitive bills_intro rep_control i.fips, cluster (sler_candid2)
mgen if competitive==0, at(IPG80=(10 20 30 40 50 60 70 80)) stub(tS13cmodel1) 
quietly logit bin_anti_womtot IPG81##competitive bills_intro rep_control i.fips, cluster (sler_candid2)
mgen if competitive==1, at(IPG81=(11 21 31 41 51 61 71 81)) stub(tS13Ccmodel1) 
graph twoway scatter tS13cmodel1pr tS13cmodel1IPG80, msymbol(Oh) mcolor(navy) || rcap tS13cmodel1ll tS13cmodel1ul tS13cmodel1IPG80, lcolor(gs10) ///
    || scatter tS13Ccmodel1pr tS13Ccmodel1IPG81, mcolor(navy) || rcap tS13Ccmodel1ll tS13Ccmodel1ul tS13Ccmodel1IPG81, lcolor(gs10) ///
	xlabel(10 "ConsRWoman" 20 "ConsRMan" 30 "Mod-LibRWoman" 40 "Mod-LibRMan" 50 "Mod-ConsDMan" 60 "Mod-ConsDWoman" 70 "LibDMan" 80 "LibDWoman") ///
	xlabel(, angle(45)labsize(small)) graphregion(color(white)) ytitle("Pr(Sponsored ≥1 Bill)")  ///
	xtitle("Legislator Ideology/Party/Gender") title("Anti Abortion: Pro-Life Pro-Woman Bills", size(small)) ///
	legend(rows(2) order(1 "Estimate, Non-Competitive State-Sessions" 2 "95% CI" 3 "Estimate, Competitive State-Sessions" 4 "95% CI") size(vsmall)) ///
	saving("tS13cmodel1.gph", replace)
	

	
logit bin_anti_fetus IPG8##competitive bills_intro rep_control i.fips, cluster (sler_candid2)
estimates store base
mtable if competitive==0, at(IPG8=(1 2 3 4 5 6 7 8)) statistics (ci se)
mtable if competitive==1, at(IPG8=(1 2 3 4 5 6 7 8)) statistics (ci se)
mchange IPG8 if competitive==0
mchange IPG8 if competitive==1

*To gauge and compare the effect of party competition across IPG8 subgroups (e.g., CRW vs. CRM):
**See Long and Freese (2014), p.285-86
mtable, dydx(competitive) over(IPG8) stat(ci pvalue) post
mlincom 1-2
mlincom 3-4
mlincom 5-6
mlincom 7-8
estimates restore base
	
quietly logit bin_anti_fetus IPG80##competitive bills_intro rep_control i.fips, cluster (sler_candid2)
mgen if competitive==0, at(IPG80=(10 20 30 40 50 60 70 80)) stub(tS13dmodel1) 
quietly logit bin_anti_fetus IPG81##competitive bills_intro rep_control i.fips, cluster (sler_candid2)
mgen if competitive==1, at(IPG81=(11 21 31 41 51 61 71 81)) stub(tS13Cdmodel1) 
graph twoway scatter tS13dmodel1pr tS13dmodel1IPG80, msymbol(Oh) mcolor(navy)  || rcap tS13dmodel1ll tS13dmodel1ul tS13dmodel1IPG80, lcolor(gs10) ///
    || scatter tS13Cdmodel1pr tS13Cdmodel1IPG81, mcolor(navy) || rcap tS13Cdmodel1ll tS13Cdmodel1ul tS13Cdmodel1IPG81, lcolor(gs10) ///
	xlabel(10 "ConsRWoman" 20 "ConsRMan" 30 "Mod-LibRWoman" 40 "Mod-LibRMan" 50 "Mod-ConsDMan" 60 "Mod-ConsDWoman" 70 "LibDMan" 80 "LibDWoman") ///
	xlabel(, angle(45)labsize(small)) graphregion(color(white)) ytitle("Pr(Sponsored ≥1 Bill)")  ///
	xtitle("Legislator Ideology/Party/Gender") title("Anti Abortion: Fetal Centric Bills", size(small)) ///
	legend(rows(2) order(1 "Estimate, Non-Competitive State-Sessions" 2 "95% CI" 3 "Estimate, Competitive State-Sessions" 4 "95% CI") size(vsmall)) ///
	saving("tS13dmodel1.gph", replace)
	

	
logit bin_anti_relig IPG8##competitive bills_intro rep_control i.fips, cluster (sler_candid2)
estimates store base
mtable if competitive==0, at(IPG8=(1 2 3 4 5 6 7 8)) statistics (ci se)
mtable if competitive==1, at(IPG8=(1 2 3 4 5 6 7 8)) statistics (ci se)
mchange IPG8 if competitive==0
mchange IPG8 if competitive==1

*To gauge and compare the effect of party control across IPG8 subgroups (e.g., CRW vs. CRM):
**See Long and Freese (2014), p.285-86
mtable, dydx(competitive) over(IPG8) stat(ci pvalue) post
mlincom 1-2
mlincom 3-4
mlincom 5-6
mlincom 7-8
estimates restore base

quietly logit bin_anti_relig IPG80##competitive bills_intro rep_control i.fips, cluster (sler_candid2)
mgen if competitive==0, at(IPG80=(10 20 30 40 50 60 70 80)) stub(tS13emodel1) 
quietly logit bin_anti_relig IPG81##competitive bills_intro  rep_control i.fips, cluster (sler_candid2)
mgen if competitive==1, at(IPG81=(11 21 31 41 51 61 71 81)) stub(tS13Cemodel1) 
graph twoway scatter tS13emodel1pr tS13emodel1IPG80, msymbol(Oh) mcolor(navy)  || rcap tS13emodel1ll tS13emodel1ul tS13emodel1IPG80, lcolor(gs10) ///
    || scatter tS13Cemodel1pr tS13Cemodel1IPG81, mcolor(navy) || rcap tS13Cemodel1ll tS13Cemodel1ul tS13Cemodel1IPG81, lcolor(gs10) ///
	xlabel(10 "ConsRWoman" 20 "ConsRMan" 30 "Mod-LibRWoman" 40 "Mod-LibRMan" 50 "Mod-ConsDMan" 60 "Mod-ConsDWoman" 70 "LibDMan" 80 "LibDWoman") ///
	xlabel(, angle(45)labsize(small)) graphregion(color(white)) ytitle("Pr(Sponsored ≥1 Bill)")  ///
	xtitle("Legislator Ideology/Party/Gender") title("Anti Abortion: Religious Bills", size(small)) ///
	legend(rows(2) order(1 "Estimate, Non-Competitive State-Sessions" 2 "95% CI" 3 "Estimate, Competitive State-Sessions" 4 "95% CI") size(vsmall)) ///
	saving("tS13emodel1.gph", replace)
	
	
**Figure A4.5: Sponsorship of Anti-Abortion Legislation by Issue Frame and Party Competition, 1997-2010 Only**
grc1leg "tS13cmodel1.gph" "tS13dmodel1.gph" "tS13emodel1.gph", col(3) ///
	graphregion(color(white)) legendfrom("tS13cmodel1.gph") ring(6) iscale(.60) ///
	saving("Figure_A4_5.gph", replace)	


	
*Clear all post-estimation variables and start over (with full dataset) for...
clear


***MODEL 2: Adding Two-Year Fixed Effects***	
use "anti_abort replication main 28Jan20.dta"


logit bin_pro_all i.IPG8 bills_intro rep_control competitive i.fips i.time, cluster (sler_candid2)
mtable, at(IPG8=(1 2 3 4 5 6 7 8)) statistics (ci se)
mgen, at(IPG8=(1 2 3 4 5 6 7 8)) stub(t12amodel2) 
graph twoway scatter t12amodel2pr t12amodel2IPG8 || rcap t12amodel2ll t12amodel2ul t12amodel2IPG8, lcolor(gs10) ///
	xlabel(1 "ConsRWoman" 2 "ConsRMan" 3 "Mod-LibRWoman" 4 "Mod-LibRMan" 5 "Mod-ConsDMan" 6 "Mod-ConsDWoman" 7 "LibDMan" 8 "LibDWoman") ///
	xlabel(, angle(45)labsize(small)) graphregion(color(white)) ytitle("Pr(Sponsored ≥1 Bill)")  ///
	xtitle("Legislator Ideology/Party/Gender") title("Pro Abortion Rights Bills", size(msmall)) legend(rows(1) order(1 "Estimate" 2 "95% CI") size(vsmall)) ///
	saving("t12amodel2.gph", replace)
mchange IPG8


logit bin_anti_all i.IPG8 bills_intro rep_control competitive i.fips i.time, cluster (sler_candid2)
mtable, at(IPG8=(1 2 3 4 5 6 7 8)) statistics (ci se)
mgen, at(IPG8=(1 2 3 4 5 6 7 8)) stub(t12bmodel2) 
graph twoway scatter t12bmodel2pr t12bmodel2IPG8 || rcap t12bmodel2ll t12bmodel2ul t12bmodel2IPG8, lcolor(gs10) ///
	xlabel(1 "ConsRWoman" 2 "ConsRMan" 3 "Mod-LibRWoman" 4 "Mod-LibRMan" 5 "Mod-ConsDMan" 6 "Mod-ConsDWoman" 7 "LibDMan" 8 "LibDWoman") ///
	xlabel(, angle(45)labsize(small)) graphregion(color(white)) ytitle("Pr(Sponsored ≥1 Bill)")  ///
	xtitle("Legislator Ideology/Party/Gender") title("Anti Abortion Bills", size(msmall)) legend(rows(1) order(1 "Estimate" 2 "95% CI") size(vsmall)) ///
	saving("t12bmodel2.gph", replace)
mchange IPG8


**Figure A5.2: Sponsorship of Any Abortion Rights or Anti-Abortion Legislation, Controlling for Two-Year Fixed Effects**
grc1leg "t12amodel2.gph" "t12bmodel2.gph", ///
	graphregion(color(white)) legendfrom("t12bmodel2.gph") ring(6)  iscale(.60) ///
	saving("Figure_A5_2.gph", replace)

	

logit bin_anti_womtot i.IPG8 bills_intro rep_control competitive i.fips i.time, cluster (sler_candid2)
mtable, at(IPG8=(1 2 3 4 5 6 7 8)) statistics (ci se)
mgen, at(IPG8=(1 2 3 4 5 6 7 8)) stub(t12cmodel2) 
graph twoway scatter t12cmodel2pr t12cmodel2IPG8 || rcap t12cmodel2ll t12cmodel2ul t12cmodel2IPG8, lcolor(gs10) ///
	xlabel(1 "ConsRWoman" 2 "ConsRMan" 3 "Mod-LibRWoman" 4 "Mod-LibRMan" 5 "Mod-ConsDMan" 6 "Mod-ConsDWoman" 7 "LibDMan" 8 "LibDWoman") ///
	xlabel(, angle(45)labsize(small)) graphregion(color(white)) ytitle("Pr(Sponsored ≥1 Bill)")  ///
	xtitle("Legislator Ideology/Party/Gender") title("Anti Abortion: Pro-Life Pro-Woman Bills", size(small)) legend(rows(1) order(1 "Estimate" 2 "95% CI") size(vsmall)) ///
	saving("t12cmodel2.gph", replace)
mchange IPG8

logit bin_anti_fetus i.IPG8 bills_intro rep_control competitive i.fips i.time, cluster (sler_candid2)
mtable, at(IPG8=(1 2 3 4 5 6 7 8)) statistics (ci se)
mgen, at(IPG8=(1 2 3 4 5 6 7 8)) stub(t12dmodel2) 
graph twoway scatter t12dmodel2pr t12dmodel2IPG8 || rcap t12dmodel2ll t12dmodel2ul t12dmodel2IPG8, lcolor(gs10) ///
	xlabel(1 "ConsRWoman" 2 "ConsRMan" 3 "Mod-LibRWoman" 4 "Mod-LibRMan" 5 "Mod-ConsDMan" 6 "Mod-ConsDWoman" 7 "LibDMan" 8 "LibDWoman") ///
	xlabel(, angle(45)labsize(small)) graphregion(color(white)) ytitle("Pr(Sponsored ≥1 Bill)")  ///
	xtitle("Legislator Ideology/Party/Gender") title("Anti Abortion: Fetal Centric Bills", size(small)) legend(rows(1) order(1 "Estimate" 2 "95% CI") size(vsmall)) ///
	saving("t12dmodel2.gph", replace)
mchange IPG8

logit bin_anti_relig i.IPG8 bills_intro rep_control competitive i.fips i.time, cluster (sler_candid2)
mtable, at(IPG8=(1 2 3 4 5 6 7 8)) statistics (ci se)
mgen, at(IPG8=(1 2 3 4 5 6 7 8)) stub(t12emodel2) 
graph twoway scatter t12emodel2pr t12emodel2IPG8 || rcap t12emodel2ll t12emodel2ul t12emodel2IPG8, lcolor(gs10) ///
	xlabel(1 "ConsRWoman" 2 "ConsRMan" 3 "Mod-LibRWoman" 4 "Mod-LibRMan" 5 "Mod-ConsDMan" 6 "Mod-ConsDWoman" 7 "LibDMan" 8 "LibDWoman") ///
	xlabel(, angle(45)labsize(small)) graphregion(color(white)) ytitle("Pr(Sponsored ≥1 Bill)")  ///
	xtitle("Legislator Ideology/Party/Gender") title("Anti Abortion: Religious Bills", size(small)) legend(rows(1) order(1 "Estimate" 2 "95% CI") size(vsmall)) ///
	saving("t12emodel2.gph", replace)
mchange IPG8


**Figure A5.3: Sponsorship of Anti-Abortion Legislation by Issue Frame, Controlling for Two-Year Fixed Effects**
grc1leg "t12cmodel2.gph" "t12dmodel2.gph" "t12emodel2.gph", col(3) ///
	graphregion(color(white)) legendfrom("t12cmodel2.gph") ring(6) iscale(.60) ///
	saving("Figure_A5_3.gph", replace)


	
*Recode IPG8 so that conditional results (competitive vs. non-competitive) can be on the same graph
*(by off-setting the competitive predictions slightly)
generate IPG80=.
replace IPG80=10 if IPG8==1
replace IPG80=20 if IPG8==2
replace IPG80=30 if IPG8==3
replace IPG80=40 if IPG8==4
replace IPG80=50 if IPG8==5
replace IPG80=60 if IPG8==6
replace IPG80=70 if IPG8==7
replace IPG80=80 if IPG8==8

generate IPG81=.
replace IPG81=11 if IPG8==1
replace IPG81=21 if IPG8==2
replace IPG81=31 if IPG8==3
replace IPG81=41 if IPG8==4
replace IPG81=51 if IPG8==5
replace IPG81=61 if IPG8==6
replace IPG81=71 if IPG8==7
replace IPG81=81 if IPG8==8


logit bin_pro_all IPG8##competitive bills_intro rep_control i.fips i.time, cluster (sler_candid2)
estimates store base
mtable if competitive==0, at(IPG8=(1 2 3 4 5 6 7 8)) statistics (ci se)
mtable if competitive==1, at(IPG8=(1 2 3 4 5 6 7 8)) statistics (ci se)
mchange IPG8 if competitive==0
mchange IPG8 if competitive==1
**NOTE: These two mchange commands may not work with Stata14 (or earlier versions). 
* They do work with Stata15, but the labels are off because of empty cells in 
* one or more IPG8-competitive combinations. 

*To gauge and compare the effect of party competition across IPG8 subgroups (e.g., CRW vs. CRM):
**See Long and Freese (2014), p.285-86
mtable, dydx(competitive) over(IPG8) stat(ci pvalue) post
*mlincom 1-2
*mlincom 2-3
mlincom 3-4
mlincom 5-6
estimates restore base
		
quietly logit bin_pro_all IPG80##competitive bills_intro rep_control i.fips i.time, cluster (sler_candid2)
mgen if competitive==0, at(IPG80=(10 20 30 40 50 60 70 80)) stub(t13amodel2) 
quietly logit bin_pro_all IPG81##competitive bills_intro rep_control i.fips i.time, cluster (sler_candid2)
mgen if competitive==1, at(IPG81=(11 21 31 41 51 61 71 81)) stub(t13Camodel2) 
graph twoway scatter t13amodel2pr t13amodel2IPG80, msymbol(Oh) mcolor(navy) || rcap t13amodel2ll t13amodel2ul t13amodel2IPG80, lcolor(gs10) ///
    || scatter t13Camodel2pr t13Camodel2IPG81, mcolor(navy) || rcap t13Camodel2ll t13Camodel2ul t13Camodel2IPG81, lcolor(gs10) ///
	xlabel(10 "ConsRWoman" 20 "ConsRMan" 30 "Mod-LibRWoman" 40 "Mod-LibRMan" 50 "Mod-ConsDMan" 60 "Mod-ConsDWoman" 70 "LibDMan" 80 "LibDWoman") ///
	xlabel(, angle(45)labsize(small)) graphregion(color(white)) ytitle("Pr(Sponsored ≥1 Bill)")  ///
	xtitle("Legislator Ideology/Party/Gender") title("Pro Abortion Rights Bills", size(msmall)) ///
	legend(rows(2) order(1 "Estimate, Non-Competitive State-Sessions" 2 "95% CI" 3 "Estimate, Competitive State-Sessions" 4 "95% CI") size(vsmall)) ///
	saving("t13amodel2.gph", replace)


	
logit bin_anti_all IPG8##competitive bills_intro rep_control i.fips i.time, cluster (sler_candid2)
estimates store base
mtable if competitive==0, at(IPG8=(1 2 3 4 5 6 7 8)) statistics (ci se)
mtable if competitive==1, at(IPG8=(1 2 3 4 5 6 7 8)) statistics (ci se)
mchange IPG8 if competitive==0
mchange IPG8 if competitive==1

*To gauge and compare the effect of party competition across IPG8 subgroups (e.g., CRW vs. CRM):
**See Long and Freese (2014), p.285-86
mtable, dydx(competitive) over(IPG8) stat(ci pvalue) post
mlincom 1-2
mlincom 3-4
mlincom 5-6
mlincom 7-8
estimates restore base

quietly logit bin_anti_all IPG80##competitive bills_intro rep_control i.fips i.time, cluster (sler_candid2)
mgen if competitive==0, at(IPG80=(10 20 30 40 50 60 70 80)) stub(t13bmodel2) 
quietly logit bin_anti_all IPG81##competitive bills_intro rep_control i.fips i.time, cluster (sler_candid2)
mgen if competitive==1, at(IPG81=(11 21 31 41 51 61 71 81)) stub(t13Cbmodel2) 
graph twoway scatter t13bmodel2pr t13bmodel2IPG80, msymbol(Oh) mcolor(navy) || rcap t13bmodel2ll t13bmodel2ul t13bmodel2IPG80, lcolor(gs10) ///
    || scatter t13Cbmodel2pr t13Cbmodel2IPG81, mcolor(navy) || rcap t13Cbmodel2ll t13Cbmodel2ul t13Cbmodel2IPG81, lcolor(gs10) ///
	xlabel(10 "ConsRWoman" 20 "ConsRMan" 30 "Mod-LibRWoman" 40 "Mod-LibRMan" 50 "Mod-ConsDMan" 60 "Mod-ConsDWoman" 70 "LibDMan" 80 "LibDWoman") ///
	xlabel(, angle(45)labsize(small)) graphregion(color(white)) ytitle("Pr(Sponsored ≥1 Bill)")  ///
	xtitle("Legislator Ideology/Party/Gender") title("Anti Abortion Bills", size(msmall)) ///
	legend(rows(2) order(1 "Estimate, Non-Competitive State-Sessions" 2 "95% CI" 3 "Estimate, Competitive State-Sessions" 4 "95% CI") size(vsmall)) ///
	saving("t13bmodel2.gph", replace)
	

**Figure A5.4: Sponsorship of Any Abortion Rights or Anti-Abortion Legislation by Party Competition, Controlling for Two-Year Fixed Effects**
grc1leg "t13amodel2.gph" "t13bmodel2.gph", ///
	graphregion(color(white)) legendfrom("t13amodel2.gph") ring(6) iscale(.60) ///
	saving("Figure_A5_4.gph", replace)


	
logit bin_anti_womtot IPG8##competitive bills_intro rep_control i.fips i.time, cluster (sler_candid2)
estimates store base
mtable if competitive==0, at(IPG8=(1 2 3 4 5 6 7 8)) statistics (ci se)
mtable if competitive==1, at(IPG8=(1 2 3 4 5 6 7 8)) statistics (ci se)
mchange IPG8 if competitive==0
mchange IPG8 if competitive==1
**NOTE: The first mchange command (if competitive==0) may not work with Stata14 (or earlier versions). 
* It does work with Stata15, but the labels are off. 

*To gauge and compare the effect of party competition across IPG8 subgroups (e.g., CRW vs. CRM):
**See Long and Freese (2014), p.285-86
mtable, dydx(competitive) over(IPG8) stat(ci pvalue) post
mlincom 1-2
mlincom 3-4
mlincom 5-6
*mlincom 7-8
estimates restore base
	
quietly logit bin_anti_womtot IPG80##competitive bills_intro rep_control i.fips i.time, cluster (sler_candid2)
mgen if competitive==0, at(IPG80=(10 20 30 40 50 60 70 80)) stub(t13cmodel2) 
quietly logit bin_anti_womtot IPG81##competitive bills_intro rep_control i.fips i.time, cluster (sler_candid2)
mgen if competitive==1, at(IPG81=(11 21 31 41 51 61 71 81)) stub(t13Ccmodel2) 
graph twoway scatter t13cmodel2pr t13cmodel2IPG80, msymbol(Oh) mcolor(navy) || rcap t13cmodel2ll t13cmodel2ul t13cmodel2IPG80, lcolor(gs10) ///
    || scatter t13Ccmodel2pr t13Ccmodel2IPG81, mcolor(navy) || rcap t13Ccmodel2ll t13Ccmodel2ul t13Ccmodel2IPG81, lcolor(gs10) ///
	xlabel(10 "ConsRWoman" 20 "ConsRMan" 30 "Mod-LibRWoman" 40 "Mod-LibRMan" 50 "Mod-ConsDMan" 60 "Mod-ConsDWoman" 70 "LibDMan" 80 "LibDWoman") ///
	xlabel(, angle(45)labsize(small)) graphregion(color(white)) ytitle("Pr(Sponsored ≥1 Bill)")  ///
	xtitle("Legislator Ideology/Party/Gender") title("Anti Abortion: Pro-Life Pro-Woman Bills", size(small)) ///
	legend(rows(2) order(1 "Estimate, Non-Competitive State-Sessions" 2 "95% CI" 3 "Estimate, Competitive State-Sessions" 4 "95% CI") size(vsmall)) ///
	saving("t13cmodel2.gph", replace)

	

logit bin_anti_fetus IPG8##competitive bills_intro rep_control i.fips i.time, cluster (sler_candid2)
estimates store base
mtable if competitive==0, at(IPG8=(1 2 3 4 5 6 7 8)) statistics (ci se)
mtable if competitive==1, at(IPG8=(1 2 3 4 5 6 7 8)) statistics (ci se)
mchange IPG8 if competitive==0
mchange IPG8 if competitive==1

*To gauge and compare the effect of party competition across IPG8 subgroups (e.g., CRW vs. CRM):
**See Long and Freese (2014), p.285-86
mtable, dydx(competitive) over(IPG8) stat(ci pvalue) post
mlincom 1-2
mlincom 3-4
mlincom 5-6
mlincom 7-8
estimates restore base
	
quietly logit bin_anti_fetus IPG80##competitive bills_intro rep_control i.fips i.time, cluster (sler_candid2)
mgen if competitive==0, at(IPG80=(10 20 30 40 50 60 70 80)) stub(t13dmodel2) 
quietly logit bin_anti_fetus IPG81##competitive bills_intro rep_control i.fips i.time, cluster (sler_candid2)
mgen if competitive==1, at(IPG81=(11 21 31 41 51 61 71 81)) stub(t13Cdmodel2) 
graph twoway scatter t13dmodel2pr t13dmodel2IPG80, msymbol(Oh) mcolor(navy) || rcap t13dmodel2ll t13dmodel2ul t13dmodel2IPG80, lcolor(gs10) ///
    || scatter t13Cdmodel2pr t13Cdmodel2IPG81, mcolor(navy) || rcap t13Cdmodel2ll t13Cdmodel2ul t13Cdmodel2IPG81, lcolor(gs10) ///
	xlabel(10 "ConsRWoman" 20 "ConsRMan" 30 "Mod-LibRWoman" 40 "Mod-LibRMan" 50 "Mod-ConsDMan" 60 "Mod-ConsDWoman" 70 "LibDMan" 80 "LibDWoman") ///
	xlabel(, angle(45)labsize(small)) graphregion(color(white)) ytitle("Pr(Sponsored ≥1 Bill)")  ///
	xtitle("Legislator Ideology/Party/Gender") title("Anti Abortion: Fetal Centric Bills", size(small)) ///
	legend(rows(2) order(1 "Estimate, Non-Competitive State-Sessions" 2 "95% CI" 3 "Estimate, Competitive State-Sessions" 4 "95% CI") size(vsmall)) ///
	saving("t13dmodel2.gph", replace)

	
	
logit bin_anti_relig IPG8##competitive bills_intro rep_control i.fips i.time, cluster (sler_candid2)
estimates store base
mtable if competitive==0, at(IPG8=(1 2 3 4 5 6 7 8)) statistics (ci se)
mtable if competitive==1, at(IPG8=(1 2 3 4 5 6 7 8)) statistics (ci se)
mchange IPG8 if competitive==0
mchange IPG8 if competitive==1

*To gauge and compare the effect of party control across IPG8 subgroups (e.g., CRW vs. CRM):
**See Long and Freese (2014), p.285-86
mtable, dydx(competitive) over(IPG8) stat(ci pvalue) post
mlincom 1-2
mlincom 3-4
mlincom 5-6
mlincom 7-8
estimates restore base

quietly logit bin_anti_relig IPG80##competitive bills_intro rep_control i.fips i.time, cluster (sler_candid2)
mgen if competitive==0, at(IPG80=(10 20 30 40 50 60 70 80)) stub(t13emodel2) 
quietly logit bin_anti_relig IPG81##competitive bills_intro  rep_control i.fips i.time, cluster (sler_candid2)
mgen if competitive==1, at(IPG81=(11 21 31 41 51 61 71 81)) stub(t13Cemodel2) 
graph twoway scatter t13emodel2pr t13emodel2IPG80, msymbol(Oh) mcolor(navy) || rcap t13emodel2ll t13emodel2ul t13emodel2IPG80, lcolor(gs10) ///
    || scatter t13Cemodel2pr t13Cemodel2IPG81, mcolor(navy) || rcap t13Cemodel2ll t13Cemodel2ul t13Cemodel2IPG81, lcolor(gs10) ///
	xlabel(10 "ConsRWoman" 20 "ConsRMan" 30 "Mod-LibRWoman" 40 "Mod-LibRMan" 50 "Mod-ConsDMan" 60 "Mod-ConsDWoman" 70 "LibDMan" 80 "LibDWoman") ///
	xlabel(, angle(45)labsize(small)) graphregion(color(white)) ytitle("Pr(Sponsored ≥1 Bill)")  ///
	xtitle("Legislator Ideology/Party/Gender") title("Anti Abortion: Religious Bills", size(small)) ///
	legend(rows(2) order(1 "Estimate, Non-Competitive State-Sessions" 2 "95% CI" 3 "Estimate, Competitive State-Sessions" 4 "95% CI") size(vsmall)) ///
	saving("t13emodel2.gph", replace)

	
**Figure A5.5: Sponsorship of Anti-Abortion Legislation by Issue Frame and Party Competition, Controlling for Two-Year Fixed Effects**
grc1leg "t13cmodel2.gph" "t13dmodel2.gph" "t13emodel2.gph", col(3) ///
	graphregion(color(white)) legendfrom("t13cmodel2.gph") ring(6) iscale(.60) ///
	saving("Figure_A5_5.gph", replace)

	
	
*Clear all post-estimation variables and start over (with new dataset) for...
clear


****MODEL 3: Legislator-Party Unit of Analysis w/ State FE ****
use "anti_abort replication leg_party 27Jan20.dta"


*Dependent Variables
gen pro_all_any=0 if bin_pro_all==0
  replace pro_all_any=1 if bin_pro_all>0
gen anti_all_any=0 if bin_anti_all==0
  replace anti_all_any=1 if bin_anti_all>0
gen anti_womtot_any=0 if bin_anti_womtot==0
  replace anti_womtot_any=1 if bin_anti_womtot>0
gen anti_fetus_any=0 if bin_anti_fetus==0
  replace anti_fetus_any=1 if bin_anti_fetus>0
gen anti_relig_any=0 if bin_anti_relig==0
  replace anti_relig_any=1 if bin_anti_relig>0

*Need to re-label IPG8
label define IPG8 1 "Cons RW" 2 "Cons RM" 3 "Mod-Lib RW" ///
                  4 "Mod-Lib RM" 5 "Mod-Cons DM" 6 "Mod-Cons DW" ///
				  7 "Lib DM" 8 "Lib DW"
label values IPG8 IPG8

*Independent Variables*
tab IPG8, mi
generate CRW=0 if IPG8!=.
replace CRW=1 if IPG8==1
generate CRM=0 if IPG8!=.
replace CRM=1 if IPG8==2
generate MRW=0 if IPG8!=.
replace MRW=1 if IPG8==3
generate MRM=0 if IPG8!=.
replace MRM=1 if IPG8==4
generate MDM=0 if IPG8!=.
replace MDM=1 if IPG8==5
generate MDW=0 if IPG8!=.
replace MDW=1 if IPG8==6
generate LDM=0 if IPG8!=.
replace LDM=1 if IPG8==7
generate LDW=0 if IPG8!=.
replace LDW=1 if IPG8==8

tab chid, mi
generate AR=0
replace AR=1 if chid=="arh"
generate AZ=0
replace AZ=1 if chid=="azh"
generate CA=0
replace CA=1 if chid=="cah"
generate CO=0
replace CO=1 if chid=="coh"
generate FL=0
replace FL=1 if chid=="flh"
generate IL=0
replace IL=1 if chid=="ilh"
generate LA=0
replace LA=1 if chid=="lah"
generate MD=0
replace MD=1 if chid=="mdh"
generate MS=0
replace MS=1 if chid=="msh"
generate ND=0
replace ND=1 if chid=="ndh"
generate NJ=0
replace NJ=1 if chid=="njh"
generate NM=0
replace NM=1 if chid=="nmh"
generate NV=0
replace NV=1 if chid=="nvh"
generate OH=0
replace OH=1 if chid=="ohh"
generate PA=0
replace PA=1 if chid=="pah"
generate SC=0
replace SC=1 if chid=="sch"
generate TN=0
replace TN=1 if chid=="tnh"
generate TX=0
replace TX=1 if chid=="txh"
generate UT=0
replace UT=1 if chid=="uth"
generate WA=0
replace WA=1 if chid=="wah"
generate WI=0
replace WI=1 if chid=="wih"


**Table A3.3: Legislator-Party Unit of Analysis**
tabstat pro_all_any anti_all_any anti_womtot_any anti_fetus_any anti_relig_any if IPG8!=., ///
   statistics( mean sd min max count) columns(statistics) longstub
   
tabstat CRW CRM MRW MRM MDM MDW LDM LDW if IPG8!=., ///
   statistics( mean sd min max count) columns(statistics) longstub

tabstat bills_intro rep_control competitive if IPG8!=., ///
   statistics( mean sd min max count) columns(statistics) longstub
   
tabstat AR-WI if IPG8!=., ///
   statistics( mean sd min max count) columns(statistics) longstub


	
logit pro_all_any i.IPG8 bills_intro rep_control competitive i.fips
mtable, at(IPG8=(1 2 3 4 5 6 7 8)) statistics (ci se)
mgen, at(IPG8=(1 2 3 4 5 6 7 8)) stub(t12amodel3) 
graph twoway scatter t12amodel3pr t12amodel3IPG8 || rcap t12amodel3ll t12amodel3ul t12amodel3IPG8, lcolor(gs10) ///
	xlabel(1 "ConsRWoman" 2 "ConsRMan" 3 "Mod-LibRWoman" 4 "Mod-LibRMan" 5 "Mod-ConsDMan" 6 "Mod-ConsDWoman" 7 "LibDMan" 8 "LibDWoman") ///
	xlabel(, angle(45)labsize(small)) graphregion(color(white)) ytitle("Pr(Sponsored ≥1 Bill)")  ///
	xtitle("Legislator Ideology/Party/Gender") title("Pro Abortion Rights Bills", size(msmall)) legend(rows(1) order(1 "Estimate" 2 "95% CI") size(vsmall)) ///
	saving("t12amodel3.gph", replace)
mchange IPG8

logit anti_all_any i.IPG8 bills_intro rep_control competitive i.fips 
mtable, at(IPG8=(1 2 3 4 5 6 7 8)) statistics (ci se)
mgen, at(IPG8=(1 2 3 4 5 6 7 8)) stub(t12bmodel3) 
graph twoway scatter t12bmodel3pr t12bmodel3IPG8 || rcap t12bmodel3ll t12bmodel3ul t12bmodel3IPG8, lcolor(gs10) ///
	xlabel(1 "ConsRWoman" 2 "ConsRMan" 3 "Mod-LibRWoman" 4 "Mod-LibRMan" 5 "Mod-ConsDMan" 6 "Mod-ConsDWoman" 7 "LibDMan" 8 "LibDWoman") ///
	xlabel(, angle(45)labsize(small)) graphregion(color(white)) ytitle("Pr(Sponsored ≥1 Bill)")  ///
	xtitle("Legislator Ideology/Party/Gender") title("Anti Abortion Bills", size(msmall)) legend(rows(1) order(1 "Estimate" 2 "95% CI") size(vsmall)) ///
	saving("t12bmodel3.gph", replace)
mchange IPG8


**Figure A6.2: Sponsorship of Any Abortion Rights or Anti-Abortion Legislation, Legislator-Party Unit of Analysis**
grc1leg "t12amodel3.gph" "t12bmodel3.gph", ///
	graphregion(color(white)) legendfrom("t12bmodel3.gph") ring(6) iscale(.60) ///
	saving("Figure_A6_2.gph", replace)

	
	
logit anti_womtot_any i.IPG8 bills_intro rep_control competitive i.fips 
mtable, at(IPG8=(1 2 3 4 5 6 7 8)) statistics (ci se)
mgen, at(IPG8=(1 2 3 4 5 6 7 8)) stub(t12cmodel3) 
graph twoway scatter t12cmodel3pr t12cmodel3IPG8 || rcap t12cmodel3ll t12cmodel3ul t12cmodel3IPG8, lcolor(gs10) ///
	xlabel(1 "ConsRWoman" 2 "ConsRMan" 3 "Mod-LibRWoman" 4 "Mod-LibRMan" 5 "Mod-ConsDMan" 6 "Mod-ConsDWoman" 7 "LibDMan" 8 "LibDWoman") ///
	xlabel(, angle(45)labsize(small)) graphregion(color(white)) ytitle("Pr(Sponsored ≥1 Bill)")  ///
	xtitle("Legislator Ideology/Party/Gender") title("Anti Abortion: Pro-Life Pro-Woman Bills", size(small)) legend(rows(1) order(1 "Estimate" 2 "95% CI") size(vsmall)) ///
	saving("t12cmodel3.gph", replace)
mchange IPG8

logit anti_fetus_any i.IPG8 bills_intro rep_control competitive i.fips 
mtable, at(IPG8=(1 2 3 4 5 6 7 8)) statistics (ci se)
mgen, at(IPG8=(1 2 3 4 5 6 7 8)) stub(t12dmodel3) 
graph twoway scatter t12dmodel3pr t12dmodel3IPG8 || rcap t12dmodel3ll t12dmodel3ul t12dmodel3IPG8, lcolor(gs10) ///
	xlabel(1 "ConsRWoman" 2 "ConsRMan" 3 "Mod-LibRWoman" 4 "Mod-LibRMan" 5 "Mod-ConsDMan" 6 "Mod-ConsDWoman" 7 "LibDMan" 8 "LibDWoman") ///
	xlabel(, angle(45)labsize(small)) graphregion(color(white)) ytitle("Pr(Sponsored ≥1 Bill)")  ///
	xtitle("Legislator Ideology/Party/Gender") title("Anti Abortion: Fetal Centric Bills", size(small)) legend(rows(1) order(1 "Estimate" 2 "95% CI") size(vsmall)) ///
	saving("t12dmodel3.gph", replace)
mchange IPG8

logit anti_relig_any i.IPG8 bills_intro rep_control competitive i.fips 
mtable, at(IPG8=(1 2 3 4 5 6 7 8)) statistics (ci se)
mgen, at(IPG8=(1 2 3 4 5 6 7 8)) stub(t12emodel3) 
graph twoway scatter t12emodel3pr t12emodel3IPG8 || rcap t12emodel3ll t12emodel3ul t12emodel3IPG8, lcolor(gs10) ///
	xlabel(1 "ConsRWoman" 2 "ConsRMan" 3 "Mod-LibRWoman" 4 "Mod-LibRMan" 5 "Mod-ConsDMan" 6 "Mod-ConsDWoman" 7 "LibDMan" 8 "LibDWoman") ///
	xlabel(, angle(45)labsize(small)) graphregion(color(white)) ytitle("Pr(Sponsored ≥1 Bill)")  ///
	xtitle("Legislator Ideology/Party/Gender") title("Anti Abortion: Religious Bills", size(small)) legend(rows(1) order(1 "Estimate" 2 "95% CI") size(vsmall)) ///
	saving("t12emodel3.gph", replace)
mchange IPG8


**Figure A6.3: Sponsorship of Anti-Abortion Legislation by Issue Frame, Legislator-Party Unit of Analysis**
grc1leg "t12cmodel3.gph" "t12dmodel3.gph" "t12emodel3.gph", col(3) ///
	graphregion(color(white)) legendfrom("t12cmodel3.gph") ring(6) iscale(.60) ///
	saving("Figure_A6_3.gph", replace)


	
*Clear all post-estimation variables and start over (with new dataset) for...
clear


**MODEL 4: Legislator-Party-Competitive Unit of Analysis w/ State FE ****
use "anti_abort replication leg_party_compet 28Jan20.dta"

*Recode DVs
gen pro_all_any=0 if bin_pro_all==0
  replace pro_all_any=1 if bin_pro_all>0
gen anti_all_any=0 if bin_anti_all==0
  replace anti_all_any=1 if bin_anti_all>0
gen anti_womtot_any=0 if bin_anti_womtot==0
  replace anti_womtot_any=1 if bin_anti_womtot>0
gen anti_fetus_any=0 if bin_anti_fetus==0
  replace anti_fetus_any=1 if bin_anti_fetus>0
gen anti_relig_any=0 if bin_anti_relig==0
  replace anti_relig_any=1 if bin_anti_relig>0


*Need to re-label IPG8
label define IPG8 1 "Cons RW" 2 "Cons RM" 3 "Mod-Lib RW" ///
                  4 "Mod-Lib RM" 5 "Mod-Cons DM" 6 "Mod-Cons DW" ///
				  7 "Lib DM" 8 "Lib DW"
label values IPG8 IPG8


*Independent Variables*
tab IPG8, mi
generate CRW=0 if IPG8!=.
replace CRW=1 if IPG8==1
generate CRM=0 if IPG8!=.
replace CRM=1 if IPG8==2
generate MRW=0 if IPG8!=.
replace MRW=1 if IPG8==3
generate MRM=0 if IPG8!=.
replace MRM=1 if IPG8==4
generate MDM=0 if IPG8!=.
replace MDM=1 if IPG8==5
generate MDW=0 if IPG8!=.
replace MDW=1 if IPG8==6
generate LDM=0 if IPG8!=.
replace LDM=1 if IPG8==7
generate LDW=0 if IPG8!=.
replace LDW=1 if IPG8==8

tab chid, mi
generate AR=0
replace AR=1 if chid=="arh"
generate AZ=0
replace AZ=1 if chid=="azh"
generate CA=0
replace CA=1 if chid=="cah"
generate CO=0
replace CO=1 if chid=="coh"
generate FL=0
replace FL=1 if chid=="flh"
generate IL=0
replace IL=1 if chid=="ilh"
generate LA=0
replace LA=1 if chid=="lah"
generate MD=0
replace MD=1 if chid=="mdh"
generate MS=0
replace MS=1 if chid=="msh"
generate ND=0
replace ND=1 if chid=="ndh"
generate NJ=0
replace NJ=1 if chid=="njh"
generate NM=0
replace NM=1 if chid=="nmh"
generate NV=0
replace NV=1 if chid=="nvh"
generate OH=0
replace OH=1 if chid=="ohh"
generate PA=0
replace PA=1 if chid=="pah"
generate SC=0
replace SC=1 if chid=="sch"
generate TN=0
replace TN=1 if chid=="tnh"
generate TX=0
replace TX=1 if chid=="txh"
generate UT=0
replace UT=1 if chid=="uth"
generate WA=0
replace WA=1 if chid=="wah"
generate WI=0
replace WI=1 if chid=="wih"


**Table A3.4: Legislator-Party-Competitive Unit of Analysis**
tabstat pro_all_any anti_all_any anti_womtot_any anti_fetus_any anti_relig_any if IPG8!=., ///
   statistics( mean sd min max count) columns(statistics) longstub
   
tabstat CRW CRM MRW MRM MDM MDW LDM LDW if IPG8!=., ///
   statistics( mean sd min max count) columns(statistics) longstub

tabstat bills_intro rep_control competitive if IPG8!=., ///
   statistics( mean sd min max count) columns(statistics) longstub
   
tabstat AR-WI if IPG8!=., ///
   statistics( mean sd min max count) columns(statistics) longstub
   
   
*Recode IPG8 so that conditional results (competitive vs. non-competitive) can be on the same graph
*(by off-setting the competitive predictions slightly)
generate IPG80=.
replace IPG80=10 if IPG8==1
replace IPG80=20 if IPG8==2
replace IPG80=30 if IPG8==3
replace IPG80=40 if IPG8==4
replace IPG80=50 if IPG8==5
replace IPG80=60 if IPG8==6
replace IPG80=70 if IPG8==7
replace IPG80=80 if IPG8==8

generate IPG81=.
replace IPG81=11 if IPG8==1
replace IPG81=21 if IPG8==2
replace IPG81=31 if IPG8==3
replace IPG81=41 if IPG8==4
replace IPG81=51 if IPG8==5
replace IPG81=61 if IPG8==6
replace IPG81=71 if IPG8==7
replace IPG81=81 if IPG8==8

	
logit pro_all_any IPG8##competitive bills_intro rep_control i.fips 
estimates store base
mtable if competitive==0, at(IPG8=(1 2 3 4 5 6 7 8)) statistics (ci se)
mtable if competitive==1, at(IPG8=(1 2 3 4 5 6 7 8)) statistics (ci se)
mchange IPG8 if competitive==0
mchange IPG8 if competitive==1
**NOTE: These two mchange commands may not work with Stata14 (or earlier versions). 
* They do work with Stata15, but the labels are off because of empty cells in 
* one or more IPG8-competitive combinations. 

*To gauge and compare the effect of party competition across IPG8 subgroups (e.g., CRW vs. CRM):
**See Long and Freese (2014), p.285-86
mtable, dydx(competitive) over(IPG8) stat(ci pvalue) post
*mlincom 2-3
mlincom 3-4
mlincom 5-6
estimates restore base

quietly logit pro_all_any IPG80##competitive bills_intro rep_control i.fips 
mgen if competitive==0, at(IPG80=(10 20 30 40 50 60 70 80)) stub(t13amodel4) 
quietly logit pro_all_any IPG81##competitive bills_intro rep_control i.fips 
mgen if competitive==1, at(IPG81=(11 21 31 41 51 61 71 81)) stub(t13Camodel4) 
graph twoway scatter t13amodel4pr t13amodel4IPG80, msymbol(Oh) mcolor(navy) || rcap t13amodel4ll t13amodel4ul t13amodel4IPG80, lcolor(gs10) ///
    || scatter t13Camodel4pr t13Camodel4IPG81, mcolor(navy) || rcap t13Camodel4ll t13Camodel4ul t13Camodel4IPG81, lcolor(gs10) ///
	xlabel(10 "ConsRWoman" 20 "ConsRMan" 30 "Mod-LibRWoman" 40 "Mod-LibRMan" 50 "Mod-ConsDMan" 60 "Mod-ConsDWoman" 70 "LibDMan" 80 "LibDWoman") ///
	xlabel(, angle(45)labsize(small)) graphregion(color(white)) ytitle("Pr(Sponsored ≥1 Bill)")  ///
	xtitle("Legislator Ideology/Party/Gender") title("Pro Abortion Rights Bills", size(msmall)) ///
	legend(rows(2) order(1 "Estimate, Non-Competitive State-Sessions" 2 "95% CI" 3 "Estimate, Competitive State-Sessions" 4 "95% CI") size(vsmall)) ///
	saving("t13amodel4.gph", replace)
	

logit anti_all_any IPG8##competitive bills_intro rep_control i.fips 
estimates store base
mtable if competitive==0, at(IPG8=(1 2 3 4 5 6 7 8)) statistics (ci se)
mtable if competitive==1, at(IPG8=(1 2 3 4 5 6 7 8)) statistics (ci se)
mchange IPG8 if competitive==0
mchange IPG8 if competitive==1

*To gauge and compare the effect of party competition across IPG8 subgroups (e.g., CRW vs. CRM):
**See Long and Freese (2014), p.285-86
mtable, dydx(competitive) over(IPG8) stat(ci pvalue) post
mlincom 1-2
mlincom 3-4
mlincom 5-6
mlincom 7-8
estimates restore base

quietly logit anti_all_any IPG80##competitive bills_intro rep_control i.fips 
mgen if competitive==0, at(IPG80=(10 20 30 40 50 60 70 80)) stub(t13bmodel4) 
quietly logit anti_all_any IPG81##competitive bills_intro rep_control i.fips 
mgen if competitive==1, at(IPG81=(11 21 31 41 51 61 71 81)) stub(t13Cbmodel4) 
graph twoway scatter t13bmodel4pr t13bmodel4IPG80, msymbol(Oh) mcolor(navy) || rcap t13bmodel4ll t13bmodel4ul t13bmodel4IPG80, lcolor(gs10) ///
    || scatter t13Cbmodel4pr t13Cbmodel4IPG81, mcolor(navy) || rcap t13Cbmodel4ll t13Cbmodel4ul t13Cbmodel4IPG81, lcolor(gs10) ///
	xlabel(10 "ConsRWoman" 20 "ConsRMan" 30 "Mod-LibRWoman" 40 "Mod-LibRMan" 50 "Mod-ConsDMan" 60 "Mod-ConsDWoman" 70 "LibDMan" 80 "LibDWoman") ///
	xlabel(, angle(45)labsize(small)) graphregion(color(white)) ytitle("Pr(Sponsored ≥1 Bill)")  ///
	xtitle("Legislator Ideology/Party/Gender") title("Anti Abortion Bills", size(msmall)) ///
	legend(rows(2) order(1 "Estimate, Non-Competitive State-Sessions" 2 "95% CI" 3 "Estimate, Competitive State-Sessions" 4 "95% CI") size(vsmall)) ///
	saving("t13bmodel4.gph", replace)


**Figure A6.4: Sponsorship of Any Abortion Rights or Anti-Abortion Legislation by Party Competition, Legislator-Party-Competitive Unit of Analysis**
grc1leg "t13amodel4.gph" "t13bmodel4.gph", ///
	graphregion(color(white)) legendfrom("t13amodel4.gph") ring(6) iscale(.60) ///
	saving("Figure_A6_4.gph", replace)

	
	
logit anti_womtot_any IPG8##competitive bills_intro rep_control i.fips 
estimates store base
mtable if competitive==0, at(IPG8=(1 2 3 4 5 6 7 8)) statistics (ci se)
mtable if competitive==1, at(IPG8=(1 2 3 4 5 6 7 8)) statistics (ci se)
mchange IPG8 if competitive==0
mchange IPG8 if competitive==1
**NOTE: The first mchange command (if competitive==0) may not work with Stata14 (or earlier versions). 
* It does work with Stata15, but the labels are off. 

*To gauge and compare the effect of party competition across IPG8 subgroups (e.g., CRW vs. CRM):
**See Long and Freese (2014), p.285-86
mtable, dydx(competitive) over(IPG8) stat(ci pvalue) post
mlincom 1-2
mlincom 3-4
mlincom 5-6
*mlincom 7-8
estimates restore base

quietly logit anti_womtot_any IPG80##competitive bills_intro rep_control i.fips 
mgen if competitive==0, at(IPG80=(10 20 30 40 50 60 70 80)) stub(t13cmodel4) 
quietly logit anti_womtot_any IPG81##competitive bills_intro rep_control i.fips
mgen if competitive==1, at(IPG81=(11 21 31 41 51 61 71 81)) stub(t13Ccmodel4) 
graph twoway scatter t13cmodel4pr t13cmodel4IPG80, msymbol(Oh) mcolor(navy) || rcap t13cmodel4ll t13cmodel4ul t13cmodel4IPG80, lcolor(gs10) ///
    || scatter t13Ccmodel4pr t13Ccmodel4IPG81, mcolor(navy) || rcap t13Ccmodel4ll t13Ccmodel4ul t13Ccmodel4IPG81, lcolor(gs10) ///
	xlabel(10 "ConsRWoman" 20 "ConsRMan" 30 "Mod-LibRWoman" 40 "Mod-LibRMan" 50 "Mod-ConsDMan" 60 "Mod-ConsDWoman" 70 "LibDMan" 80 "LibDWoman") ///
	xlabel(, angle(45)labsize(small)) graphregion(color(white)) ytitle("Pr(Sponsored ≥1 Bill)")  ///
	xtitle("Legislator Ideology/Party/Gender") title("Anti Abortion: Pro-Life Pro-Woman Bills", size(small)) ///
	legend(rows(2) order(1 "Estimate, Non-Competitive State-Sessions" 2 "95% CI" 3 "Estimate, Competitive State-Sessions" 4 "95% CI") size(vsmall)) ///
	saving("t13cmodel4.gph", replace)
	
	

logit anti_fetus_any IPG8##competitive bills_intro rep_control i.fips 
estimates store base
mtable if competitive==0, at(IPG8=(1 2 3 4 5 6 7 8)) statistics (ci se)
mtable if competitive==1, at(IPG8=(1 2 3 4 5 6 7 8)) statistics (ci se)
mchange IPG8 if competitive==0
mchange IPG8 if competitive==1

*To gauge and compare the effect of party competition across IPG8 subgroups (e.g., CRW vs. CRM):
**See Long and Freese (2014), p.285-86
mtable, dydx(competitive) over(IPG8) stat(ci pvalue) post
mlincom 1-2
mlincom 3-4
mlincom 5-6
mlincom 7-8
estimates restore base
	
quietly logit anti_fetus_any IPG80##competitive bills_intro rep_control i.fips 
mgen if competitive==0, at(IPG80=(10 20 30 40 50 60 70 80)) stub(t13dmodel4) 
quietly logit anti_fetus_any IPG81##competitive bills_intro rep_control i.fips 
mgen if competitive==1, at(IPG81=(11 21 31 41 51 61 71 81)) stub(t13Cdmodel4) 
graph twoway scatter t13dmodel4pr t13dmodel4IPG80, msymbol(Oh) mcolor(navy) || rcap t13dmodel4ll t13dmodel4ul t13dmodel4IPG80, lcolor(gs10) ///
    || scatter t13Cdmodel4pr t13Cdmodel4IPG81, mcolor(navy) || rcap t13Cdmodel4ll t13Cdmodel4ul t13Cdmodel4IPG81, lcolor(gs10) ///
	xlabel(10 "ConsRWoman" 20 "ConsRMan" 30 "Mod-LibRWoman" 40 "Mod-LibRMan" 50 "Mod-ConsDMan" 60 "Mod-ConsDWoman" 70 "LibDMan" 80 "LibDWoman") ///
	xlabel(, angle(45)labsize(small)) graphregion(color(white)) ytitle("Pr(Sponsored ≥1 Bill)")  ///
	xtitle("Legislator Ideology/Party/Gender") title("Anti Abortion: Fetal Centric Bills", size(small)) ///
	legend(rows(2) order(1 "Estimate, Non-Competitive State-Sessions" 2 "95% CI" 3 "Estimate, Competitive State-Sessions" 4 "95% CI") size(vsmall)) ///
	saving("t13dmodel4.gph", replace)
	
	
	
logit anti_relig_any IPG8##competitive bills_intro rep_control i.fips 
estimates store base
mtable if competitive==0, at(IPG8=(1 2 3 4 5 6 7 8)) statistics (ci se)
mtable if competitive==1, at(IPG8=(1 2 3 4 5 6 7 8)) statistics (ci se)
mchange IPG8 if competitive==0
mchange IPG8 if competitive==1

*To gauge and compare the effect of party control across IPG8 subgroups (e.g., CRW vs. CRM):
**See Long and Freese (2014), p.285-86
mtable, dydx(competitive) over(IPG8) stat(ci pvalue) post
mlincom 1-2
mlincom 3-4
mlincom 5-6
mlincom 7-8
estimates restore base

quietly logit anti_relig_any IPG80##competitive bills_intro rep_control i.fips 
mgen if competitive==0, at(IPG80=(10 20 30 40 50 60 70 80)) stub(t13emodel4) 
quietly logit anti_relig_any IPG81##competitive bills_intro  rep_control i.fips 
mgen if competitive==1, at(IPG81=(11 21 31 41 51 61 71 81)) stub(t13Cemodel4) 
graph twoway scatter t13emodel4pr t13emodel4IPG80, msymbol(Oh) mcolor(navy) || rcap t13emodel4ll t13emodel4ul t13emodel4IPG80, lcolor(gs10) ///
    || scatter t13Cemodel4pr t13Cemodel4IPG81, mcolor(navy) || rcap t13Cemodel4ll t13Cemodel4ul t13Cemodel4IPG81, lcolor(gs10) ///
	xlabel(10 "ConsRWoman" 20 "ConsRMan" 30 "Mod-LibRWoman" 40 "Mod-LibRMan" 50 "Mod-ConsDMan" 60 "Mod-ConsDWoman" 70 "LibDMan" 80 "LibDWoman") ///
	xlabel(, angle(45)labsize(small)) graphregion(color(white)) ytitle("Pr(Sponsored ≥1 Bill)")  ///
	xtitle("Legislator Ideology/Party/Gender") title("Anti Abortion: Religious Bills", size(small)) ///
	legend(rows(2) order(1 "Estimate, Non-Competitive State-Sessions" 2 "95% CI" 3 "Estimate, Competitive State-Sessions" 4 "95% CI") size(vsmall)) ///
	saving("t13emodel4.gph", replace)

	
**Figure A6.5: Sponsorship of Anti-Abortion Legislation by Issue Frame and Party Competition, Legislator-Party-Competitive Unit of Analysis**
grc1leg "t13cmodel4.gph" "t13dmodel4.gph" "t13emodel4.gph", col(3) ///
	graphregion(color(white)) legendfrom("t13cmodel4.gph") ring(6) iscale(.60) ///
	saving("Figure_A6_5.gph", replace)

	

*Clear all post-estimation variables and start over (with main dataset) for...
clear



***MODEL 5: Conditional Effects of Party Control; Legislator-Session w/ State FE and SE Cluster(sler_candid2)****
use "anti_abort replication main 28Jan20.dta"
     
   
*Recode IPG8 so that conditional results (Democratic vs. Republican Control) can be on the same graph
*(by off-setting the Republican-control predictions slightly)
generate IPG80=.
replace IPG80=10 if IPG8==1
replace IPG80=20 if IPG8==2
replace IPG80=30 if IPG8==3
replace IPG80=40 if IPG8==4
replace IPG80=50 if IPG8==5
replace IPG80=60 if IPG8==6
replace IPG80=70 if IPG8==7
replace IPG80=80 if IPG8==8

generate IPG81=.
replace IPG81=11 if IPG8==1
replace IPG81=21 if IPG8==2
replace IPG81=31 if IPG8==3
replace IPG81=41 if IPG8==4
replace IPG81=51 if IPG8==5
replace IPG81=61 if IPG8==6
replace IPG81=71 if IPG8==7
replace IPG81=81 if IPG8==8


logit bin_pro_all IPG8##rep_control bills_intro competitive i.fips if party_split!=1, cluster (sler_candid2)
estimates store base
mtable if rep_control==0, at(IPG8=(1 2 3 4 5 6 7 8)) statistics (ci se)
mtable if rep_control==1, at(IPG8=(1 2 3 4 5 6 7 8)) statistics (ci se)
mchange IPG8 if rep_control==0
mchange IPG8 if rep_control==1
**NOTE: These two mchange commands may not work with Stata14 (or earlier versions). 
* They do work with Stata15, but the labels are off because of empty cells in 
* one or more IPG8-competitive combinations.

*To gauge and compare the effect of party control across IPG8 subgroups (e.g., CRW vs. CRM):
**See Long and Freese (2014), p.285-86
mtable, dydx(rep_control) over(IPG8) stat(ci pvalue) post
mlincom 2-3
mlincom 4-5
estimates restore base
	
quietly logit bin_pro_all IPG80##rep_control bills_intro competitive i.fips if party_split!=1, cluster (sler_candid2)
mgen if rep_control==0, at(IPG80=(10 20 30 40 50 60 70 80)) stub(t14Damodel5) 
quietly logit bin_pro_all IPG81##rep_control bills_intro competitive i.fips if party_split!=1, cluster (sler_candid2)
mgen if rep_control==1, at(IPG81=(11 21 31 41 51 61 71 81)) stub(t14Ramodel5) 
graph twoway scatter t14Damodel5pr t14Damodel5IPG80, mcolor(blue) msymbol(D) || rcap t14Damodel5ll t14Damodel5ul t14Damodel5IPG80, lcolor(gs10) ///
    || scatter t14Ramodel5pr t14Ramodel5IPG81, mcolor(red) msymbol(T) || rcap t14Ramodel5ll t14Ramodel5ul t14Ramodel5IPG81, lcolor(gs10) ///
	xlabel(10 "ConsRWoman" 20 "ConsRMan" 30 "Mod-LibRWoman" 40 "Mod-LibRMan" 50 "Mod-ConsDMan" 60 "Mod-ConsDWoman" 70 "LibDMan" 80 "LibDWoman") ///
	xlabel(, angle(45)labsize(small)) graphregion(color(white)) ytitle("Pr(Sponsored ≥1 Bill)")  ///
	xtitle("Legislator Ideology/Party/Gender") title("Pro Abortion Rights Bills", size(msmall)) ///
	legend(rows(2) order(1 "Estimate, Democratic Controlled Chambers" 2 "95% CI" 3 "Estimate, Republican Controlled Chambers" 4 "95% CI") size(vsmall)) ///
	saving("t14amodel5.gph", replace)
	
	
	
logit bin_anti_all IPG8##rep_control bills_intro competitive i.fips if party_split!=1, cluster (sler_candid2)
estimates store base
mtable if rep_control==0, at(IPG8=(1 2 3 4 5 6 7 8)) statistics (ci se)
mtable if rep_control==1, at(IPG8=(1 2 3 4 5 6 7 8)) statistics (ci se)
mchange IPG8 if rep_control==0
mchange IPG8 if rep_control==1

*To gauge and compare the effect of party control across IPG8 subgroups (e.g., CRW vs. CRM):
**See Long and Freese (2014), p.285-86
mtable, dydx(rep_control) over(IPG8) stat(ci pvalue) post
mlincom 1-2
mlincom 3-4
mlincom 5-6
mlincom 7-8
estimates restore base

quietly logit bin_anti_all IPG80##rep_control bills_intro competitive i.fips if party_split!=1, cluster (sler_candid2)
mgen if rep_control==0, at(IPG80=(10 20 30 40 50 60 70 80)) stub(t14Dbmodel5) 
quietly logit bin_anti_all IPG81##rep_control bills_intro competitive i.fips if party_split!=1, cluster (sler_candid2)
mgen if rep_control==1, at(IPG81=(11 21 31 41 51 61 71 81)) stub(t14Rbmodel5) 
graph twoway scatter t14Dbmodel5pr t14Dbmodel5IPG80, mcolor(blue) msymbol(D) || rcap t14Dbmodel5ll t14Dbmodel5ul t14Dbmodel5IPG80, lcolor(gs10) ///
    || scatter t14Rbmodel5pr t14Rbmodel5IPG81, mcolor(red) msymbol(T) || rcap t14Rbmodel5ll t14Rbmodel5ul t14Rbmodel5IPG81, lcolor(gs10) ///
	xlabel(10 "ConsRWoman" 20 "ConsRMan" 30 "Mod-LibRWoman" 40 "Mod-LibRMan" 50 "Mod-ConsDMan" 60 "Mod-ConsDWoman" 70 "LibDMan" 80 "LibDWoman") ///
	xlabel(, angle(45)labsize(small)) graphregion(color(white)) ytitle("Pr(Sponsored ≥1 Bill)")  ///
	xtitle("Legislator Ideology/Party/Gender") title("Anti Abortion Bills", size(msmall)) ///
	legend(rows(2) order(1 "Estimate, Democratic Controlled Chambers" 2 "95% CI" 3 "Estimate, Republican Controlled Chambers" 4 "95% CI") size(vsmall)) ///
	saving("t14bmodel5.gph", replace)

	
**Figure A7.4: Sponsorship of Any Abortion Rights or Anti-Abortion Legislation by Party Control**
grc1leg "t14amodel5.gph" "t14bmodel5.gph", ///
	graphregion(color(white)) legendfrom("t14bmodel5.gph") ring(6) iscale(.60) ///
	saving("Figure_A7_4.gph", replace)
	
	

logit bin_anti_womtot IPG8##rep_control bills_intro competitive i.fips if party_split!=1, cluster (sler_candid2)
estimates store base
mtable if rep_control==0, at(IPG8=(1 2 3 4 5 6 7 8)) statistics (ci se)
mtable if rep_control==1, at(IPG8=(1 2 3 4 5 6 7 8)) statistics (ci se)
mchange IPG8 if rep_control==0
mchange IPG8 if rep_control==1
**NOTE: The second mchange command (if rep_control==1) may not work with Stata14 (or earlier versions). 
* It does work with Stata15, but the labels are off. 

*To gauge and compare the effect of party control across IPG8 subgroups (e.g., CRW vs. CRM):
**See Long and Freese (2014), p.285-86
mtable, dydx(rep_control) over(IPG8) stat(ci pvalue) post
mlincom 1-2
mlincom 3-4
mlincom 5-6
*mlincom 7-8
estimates restore base

quietly logit bin_anti_womtot IPG80##rep_control bills_intro competitive i.fips if party_split!=1, cluster (sler_candid2)
mgen if rep_control==0, at(IPG80=(10 20 30 40 50 60 70 80)) stub(t14Dcmodel5) 
quietly logit bin_anti_womtot IPG81##rep_control bills_intro competitive i.fips if party_split!=1, cluster (sler_candid2)
mgen if rep_control==1, at(IPG81=(11 21 31 41 51 61 71 81)) stub(t14Rcmodel5) 
graph twoway scatter t14Dcmodel5pr t14Dcmodel5IPG80, mcolor(blue) msymbol(D) || rcap t14Dcmodel5ll t14Dcmodel5ul t14Dcmodel5IPG80, lcolor(gs10) ///
    || scatter t14Rcmodel5pr t14Rcmodel5IPG81, mcolor(red) msymbol(T) || rcap t14Rcmodel5ll t14Rcmodel5ul t14Rcmodel5IPG81, lcolor(gs10) ///
	xlabel(10 "ConsRWoman" 20 "ConsRMan" 30 "Mod-LibRWoman" 40 "Mod-LibRMan" 50 "Mod-ConsDMan" 60 "Mod-ConsDWoman" 70 "LibDMan" 80 "LibDWoman") ///
	xlabel(, angle(45)labsize(small)) graphregion(color(white)) ytitle("Pr(Sponsored ≥1 Bill)")  ///
	xtitle("Legislator Ideology/Party/Gender") title("Anti Abortion: Pro-Life Pro-Woman Bills", size(small)) ///
	legend(rows(2) order(1 "Estimate, Democratic Controlled Chambers" 2 "95% CI" 3 "Estimate, Republican Controlled Chambers" 4 "95% CI") size(vsmall)) ///
	saving("t14cmodel5.gph", replace)
	
	
logit bin_anti_fetus IPG8##rep_control bills_intro competitive i.fips if party_split!=1, cluster (sler_candid2)
estimates store base
mtable if rep_control==0, at(IPG8=(1 2 3 4 5 6 7 8)) statistics (ci se)
mtable if rep_control==1, at(IPG8=(1 2 3 4 5 6 7 8)) statistics (ci se)
mchange IPG8 if rep_control==0
mchange IPG8 if rep_control==1
**NOTE: The first mchange command (if rep_control==0) may not work with Stata14 (or earlier versions). 
* It does work with Stata15, but the labels are off. 

*To gauge and compare the effect of party control across IPG8 subgroups (e.g., CRW vs. CRM):
**See Long and Freese (2014), p.285-86
mtable, dydx(rep_control) over(IPG8) stat(ci pvalue) post
mlincom 1-2
mlincom 3-4
mlincom 5-6
*mlincom 7-8
estimates restore base

quietly logit bin_anti_fetus IPG80##rep_control bills_intro competitive i.fips if party_split!=1, cluster (sler_candid2)
mgen if rep_control==0, at(IPG80=(10 20 30 40 50 60 70 80)) stub(t14Ddmodel5) 
quietly logit bin_anti_fetus IPG81##rep_control bills_intro competitive i.fips if party_split!=1, cluster (sler_candid2)
mgen if rep_control==1, at(IPG81=(11 21 31 41 51 61 71 81)) stub(t14Rdmodel5) 
graph twoway scatter t14Ddmodel5pr t14Ddmodel5IPG80, mcolor(blue) msymbol(D) || rcap t14Ddmodel5ll t14Ddmodel5ul t14Ddmodel5IPG80, lcolor(gs10) ///
    || scatter t14Rdmodel5pr t14Rdmodel5IPG81, mcolor(red) msymbol(T) || rcap t14Rdmodel5ll t14Rdmodel5ul t14Rdmodel5IPG81, lcolor(gs10) ///
	xlabel(10 "ConsRWoman" 20 "ConsRMan" 30 "Mod-LibRWoman" 40 "Mod-LibRMan" 50 "Mod-ConsDMan" 60 "Mod-ConsDWoman" 70 "LibDMan" 80 "LibDWoman") ///
	xlabel(, angle(45)labsize(small)) graphregion(color(white)) ytitle("Pr(Sponsored ≥1 Bill)")  ///
	xtitle("Legislator Ideology/Party/Gender") title("Anti Abortion: Fetal Centric Bills", size(small)) ///
	legend(rows(2) order(1 "Estimate, Democratic Controlled Chambers" 2 "95% CI" 3 "Estimate, Republican Controlled Chambers" 4 "95% CI") size(vsmall)) ///
	saving("t14dmodel5.gph", replace)
	
	
	
logit bin_anti_relig IPG8##rep_control bills_intro competitive i.fips if party_split!=1, cluster (sler_candid2)
estimates store base
mtable if rep_control==0, at(IPG8=(1 2 3 4 5 6 7 8)) statistics (ci se)
mtable if rep_control==1, at(IPG8=(1 2 3 4 5 6 7 8)) statistics (ci se)
mchange IPG8 if rep_control==0
mchange IPG8 if rep_control==1

*To gauge and compare the effect of party control across IPG8 subgroups (e.g., CRW vs. CRM):
**See Long and Freese (2014), p.285-86
mtable, dydx(rep_control) over(IPG8) stat(ci pvalue) post
mlincom 1-2
mlincom 3-4
mlincom 5-6
mlincom 7-8
estimates restore base
	
quietly logit bin_anti_relig IPG80##rep_control bills_intro competitive i.fips if party_split!=1, cluster (sler_candid2)
mgen if rep_control==0, at(IPG80=(10 20 30 40 50 60 70 80)) stub(t14Demodel5) 
quietly logit bin_anti_relig IPG81##rep_control bills_intro competitive i.fips if party_split!=1, cluster (sler_candid2)
mgen if rep_control==1, at(IPG81=(11 21 31 41 51 61 71 81)) stub(t14Remodel5) 
graph twoway scatter t14Demodel5pr t14Demodel5IPG80, mcolor(blue) msymbol(D) || rcap t14Demodel5ll t14Demodel5ul t14Demodel5IPG80, lcolor(gs10) ///
    || scatter t14Remodel5pr t14Remodel5IPG81, mcolor(red) msymbol(T) || rcap t14Remodel5ll t14Remodel5ul t14Remodel5IPG81, lcolor(gs10) ///
	xlabel(10 "ConsRWoman" 20 "ConsRMan" 30 "Mod-LibRWoman" 40 "Mod-LibRMan" 50 "Mod-ConsDMan" 60 "Mod-ConsDWoman" 70 "LibDMan" 80 "LibDWoman") ///
	xlabel(, angle(45)labsize(small)) graphregion(color(white)) ytitle("Pr(Sponsored ≥1 Bill)")  ///
	xtitle("Legislator Ideology/Party/Gender") title("Anti Abortion: Religious Bills", size(small)) ///
	legend(rows(2) order(1 "Estimate, Democratic Controlled Chambers" 2 "95% CI" 3 "Estimate, Republican Controlled Chambers" 4 "95% CI") size(vsmall)) ///
	saving("t14emodel5.gph", replace)
	

**Figure A7.5: Sponsorship of Anti-Abortion Legislation by Issue Frame and Party Control**
grc1leg "t14cmodel5.gph" "t14dmodel5.gph" "t14emodel5.gph", col(3) ///
	graphregion(color(white)) legendfrom("t14cmodel5.gph") ring(6) iscale(.60) ///
	saving("Figure_A7.5.gph", replace)

clear
